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

Side by Side Diff: printing/printing_utils.cc

Issue 1212883003: Include user email into document title before spooling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Jul 6 10:13:42 PDT 2015 Created 5 years, 5 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/printing_utils.h" 5 #include "printing/printing_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "third_party/icu/source/common/unicode/uchar.h" 9 #include "third_party/icu/source/common/unicode/uchar.h"
10 #include "ui/gfx/text_elider.h" 10 #include "ui/gfx/text_elider.h"
11 11
12 namespace {
13 const int kMaxDocumentTitleLength = 50;
14 }
15
16 namespace printing { 12 namespace printing {
17 13
18 base::string16 SimplifyDocumentTitle(const base::string16& title) { 14 base::string16 SimplifyDocumentTitleWithLength(const base::string16& title,
15 size_t length) {
19 base::string16 no_controls(title); 16 base::string16 no_controls(title);
20 no_controls.erase( 17 no_controls.erase(
21 std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl), 18 std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl),
22 no_controls.end()); 19 no_controls.end());
23 base::string16 result; 20 base::string16 result;
24 gfx::ElideString(no_controls, kMaxDocumentTitleLength, &result); 21 gfx::ElideString(no_controls, static_cast<int>(length), &result);
25 return result; 22 return result;
26 } 23 }
27 24
25 base::string16 SimplifyDocumentTitle(const base::string16& title) {
26 return SimplifyDocumentTitleWithLength(title, kMaxDocumentTitleLength);
27 }
28
28 } // namespace printing 29 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698