Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: printing/backend/print_backend.cc

Issue 59903019: Moved SimplifyDocumentTitle from printing/backend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/backend/print_backend.h ('k') | printing/backend/print_backend_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « printing/backend/print_backend.h ('k') | printing/backend/print_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698