summaryrefslogtreecommitdiffstats
path: root/printing/backend/print_backend.cc
blob: b7eb5a142d62e777fdec325edf766efbb495fafe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "printing/backend/print_backend.h"

#include <algorithm>

#include "third_party/icu/source/common/unicode/uchar.h"
#include "ui/gfx/text_elider.h"

const int kMaxDocumentTitleLength = 50;

namespace printing {

PrinterBasicInfo::PrinterBasicInfo()
    : printer_status(0),
      is_default(false) {}

PrinterBasicInfo::~PrinterBasicInfo() {}

PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults()
    : color_changeable(false),
      duplex_capable(false),
      color_default(false),
      duplex_default(UNKNOWN_DUPLEX_MODE) {}

PrinterSemanticCapsAndDefaults::~PrinterSemanticCapsAndDefaults() {}

PrinterCapsAndDefaults::PrinterCapsAndDefaults() {}

PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {}

PrintBackend::~PrintBackend() {}

base::string16 PrintBackend::SimplifyDocumentTitle(
    const base::string16& title) {
  base::string16 no_controls(title);
  no_controls.erase(
    std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl),
    no_controls.end());
  base::string16 result;
  gfx::ElideString(no_controls, kMaxDocumentTitleLength, &result);
  return result;
}

}  // namespace printing