print_backend.cc revision ca12bfac764ba476d6cd062bf1dde12cc64c3f40
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "printing/backend/print_backend.h"
6
7#include <algorithm>
8
9#include "third_party/icu/source/common/unicode/uchar.h"
10#include "ui/base/text/text_elider.h"
11
12namespace {
13
14const wchar_t kDefaultDocumentTitle[] = L"Untitled Document";
15const int kMaxDocumentTitleLength = 50;
16
17}  // namespace
18
19namespace printing {
20
21PrinterBasicInfo::PrinterBasicInfo()
22    : printer_status(0),
23      is_default(false) {}
24
25PrinterBasicInfo::~PrinterBasicInfo() {}
26
27PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults()
28    : color_changeable(false),
29      duplex_capable(false),
30      color_default(false),
31      duplex_default(UNKNOWN_DUPLEX_MODE) {}
32
33PrinterSemanticCapsAndDefaults::~PrinterSemanticCapsAndDefaults() {}
34
35PrinterCapsAndDefaults::PrinterCapsAndDefaults() {}
36
37PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {}
38
39PrintBackend::~PrintBackend() {}
40
41string16 PrintBackend::SimplifyDocumentTitle(const string16& title) {
42  string16 no_controls(title);
43  no_controls.erase(
44    std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl),
45    no_controls.end());
46  string16 result;
47  ui::ElideString(no_controls, kMaxDocumentTitleLength, &result);
48  return result;
49}
50
51}  // namespace printing
52