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

Unified Diff: printing/printing_utils.cc

Issue 1656933004: Printing: Remove backslashes from print job names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | printing/printing_utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printing_utils.cc
diff --git a/printing/printing_utils.cc b/printing/printing_utils.cc
index b0544e4f1a3e38be1d7ce860fffcde57f18c6c22..353a0aab1e9a4aca65857e0a6f9f61eee6268528 100644
--- a/printing/printing_utils.cc
+++ b/printing/printing_utils.cc
@@ -9,7 +9,7 @@
#include <algorithm>
#include "base/logging.h"
-
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "third_party/icu/source/common/unicode/uchar.h"
#include "ui/gfx/text_elider.h"
@@ -28,6 +28,8 @@ base::string16 SimplifyDocumentTitleWithLength(const base::string16& title,
no_controls.erase(
std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl),
no_controls.end());
+ base::ReplaceChars(no_controls, base::ASCIIToUTF16("\\"),
+ base::ASCIIToUTF16("_"), &no_controls);
base::string16 result;
gfx::ElideString(no_controls, length, &result);
return result;
@@ -38,7 +40,7 @@ base::string16 FormatDocumentTitleWithOwnerAndLength(
const base::string16& title,
size_t length) {
const base::string16 separator = base::ASCIIToUTF16(": ");
- DCHECK(separator.size() < length);
+ DCHECK_LT(separator.size(), length);
base::string16 short_title =
SimplifyDocumentTitleWithLength(owner, length - separator.size());
« no previous file with comments | « no previous file | printing/printing_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698