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/public/common/unicode/uchar.h" |
| 10 #include "ui/base/text/text_elider.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 const wchar_t kDefaultDocumentTitle[] = L"Untitled Document"; |
| 15 const int kMaxDocumentTitleLength = 25; |
| 16 |
| 17 } // namespace |
| 18 |
7 namespace printing { | 19 namespace printing { |
8 | 20 |
9 PrinterBasicInfo::PrinterBasicInfo() | 21 PrinterBasicInfo::PrinterBasicInfo() |
10 : printer_status(0), | 22 : printer_status(0), |
11 is_default(false) {} | 23 is_default(false) {} |
12 | 24 |
13 PrinterBasicInfo::~PrinterBasicInfo() {} | 25 PrinterBasicInfo::~PrinterBasicInfo() {} |
14 | 26 |
15 PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults() | 27 PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults() |
16 : color_capable(false), | 28 : color_capable(false), |
17 duplex_capable(false), | 29 duplex_capable(false), |
18 color_default(false), | 30 color_default(false), |
19 duplex_default(UNKNOWN_DUPLEX_MODE) {} | 31 duplex_default(UNKNOWN_DUPLEX_MODE) {} |
20 | 32 |
21 PrinterSemanticCapsAndDefaults::~PrinterSemanticCapsAndDefaults() {} | 33 PrinterSemanticCapsAndDefaults::~PrinterSemanticCapsAndDefaults() {} |
22 | 34 |
23 PrinterCapsAndDefaults::PrinterCapsAndDefaults() {} | 35 PrinterCapsAndDefaults::PrinterCapsAndDefaults() {} |
24 | 36 |
25 PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {} | 37 PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {} |
26 | 38 |
27 PrintBackend::~PrintBackend() {} | 39 PrintBackend::~PrintBackend() {} |
28 | 40 |
| 41 string16 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 |
29 } // namespace printing | 51 } // namespace printing |
OLD | NEW |