Update UI for WebStore bundle installs.
[chromium-blink-merge.git] / printing / printing_utils.cc
blob3d91de1bf0bfb0cf6cfbeb65e546b4605c0b4ce6
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
3 // found in the LICENSE file.
5 #include "printing/printing_utils.h"
7 #include <algorithm>
9 #include "third_party/icu/source/common/unicode/uchar.h"
10 #include "ui/gfx/text_elider.h"
12 namespace {
13 const int kMaxDocumentTitleLength = 50;
16 namespace printing {
18 base::string16 SimplifyDocumentTitle(const base::string16& title) {
19 base::string16 no_controls(title);
20 no_controls.erase(
21 std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl),
22 no_controls.end());
23 base::string16 result;
24 gfx::ElideString(no_controls, kMaxDocumentTitleLength, &result);
25 return result;
28 } // namespace printing