forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved SimplifyDocumentTitle from printing/backend
TBR=noamsml Review URL: https://codereview.chromium.org/59903019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234127 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
vitalybuka@chromium.org
committed
Nov 9, 2013
1 parent
014a62c
commit ec91bfa
Showing
10 changed files
with
78 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "printing/printing_utils.h" | ||
|
||
#include <algorithm> | ||
|
||
#include "third_party/icu/source/common/unicode/uchar.h" | ||
#include "ui/gfx/text_elider.h" | ||
|
||
namespace { | ||
const int kMaxDocumentTitleLength = 50; | ||
} | ||
|
||
namespace printing { | ||
|
||
base::string16 SimplifyDocumentTitle(const base::string16& title) { | ||
base::string16 no_controls(title); | ||
no_controls.erase( | ||
std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl), | ||
no_controls.end()); | ||
base::string16 result; | ||
gfx::ElideString(no_controls, kMaxDocumentTitleLength, &result); | ||
return result; | ||
} | ||
|
||
} // namespace printing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef PRINTING_PRINTING_UTILS_H_ | ||
#define PRINTING_PRINTING_UTILS_H_ | ||
|
||
#include "base/strings/string16.h" | ||
#include "printing/printing_export.h" | ||
|
||
namespace printing { | ||
|
||
// Simplify title to resolve issue with some drivers. | ||
PRINTING_EXPORT base::string16 SimplifyDocumentTitle( | ||
const base::string16& title); | ||
|
||
} // namespace printing | ||
|
||
#endif // PRINTING_PRINTING_UTILS_H_ |
8 changes: 4 additions & 4 deletions
8
printing/backend/print_backend_unittest.cc → printing/printing_utils_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters