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