15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "printing/backend/print_backend.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <algorithm>
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
9ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "third_party/icu/source/common/unicode/uchar.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/text/text_elider.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const wchar_t kDefaultDocumentTitle[] = L"Untitled Document";
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int kMaxDocumentTitleLength = 50;
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace printing {
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrinterBasicInfo::PrinterBasicInfo()
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    : printer_status(0),
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      is_default(false) {}
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrinterBasicInfo::~PrinterBasicInfo() {}
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults()
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    : color_changeable(false),
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      duplex_capable(false),
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      color_default(false),
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      duplex_default(UNKNOWN_DUPLEX_MODE) {}
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrinterSemanticCapsAndDefaults::~PrinterSemanticCapsAndDefaults() {}
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrinterCapsAndDefaults::PrinterCapsAndDefaults() {}
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {}
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PrintBackend::~PrintBackend() {}
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)string16 PrintBackend::SimplifyDocumentTitle(const string16& title) {
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  string16 no_controls(title);
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  no_controls.erase(
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl),
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    no_controls.end());
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  string16 result;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ui::ElideString(no_controls, kMaxDocumentTitleLength, &result);
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return result;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace printing
52