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

Unified Diff: chrome/renderer/web_apps.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/web_apps.cc
diff --git a/chrome/renderer/web_apps.cc b/chrome/renderer/web_apps.cc
index aadacca505580fbfddcda5254c53a363010a5c79..95514bb5da80b412453657608268c15cc3f04e76 100644
--- a/chrome/renderer/web_apps.cc
+++ b/chrome/renderer/web_apps.cc
@@ -39,7 +39,7 @@ namespace {
// Sizes a single size (the width or height) from a 'sizes' attribute. A size
// matches must match the following regex: [1-9][0-9]*.
-int ParseSingleIconSize(const base::string16& text) {
+int ParseSingleIconSize(const base::StringPiece16& text) {
// Size must not start with 0, and be between 0 and 9.
if (text.empty() || !(text[0] >= L'1' && text[0] <= L'9'))
return 0;
@@ -59,8 +59,9 @@ int ParseSingleIconSize(const base::string16& text) {
// [1-9][0-9]*x[1-9][0-9]*.
// If the input couldn't be parsed, a size with a width/height == 0 is returned.
gfx::Size ParseIconSize(const base::string16& text) {
- std::vector<base::string16> sizes;
- base::SplitStringDontTrim(text, L'x', &sizes);
+ std::vector<base::StringPiece16> sizes = base::SplitStringPiece(
+ text, base::string16(1, 'x'),
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
if (sizes.size() != 2)
return gfx::Size();
@@ -99,8 +100,9 @@ bool ParseIconSizes(const base::string16& text,
std::vector<gfx::Size>* sizes,
bool* is_any) {
*is_any = false;
- std::vector<base::string16> size_strings;
- base::SplitStringAlongWhitespace(text, &size_strings);
+ std::vector<base::string16> size_strings = base::SplitString(
+ text, base::kWhitespaceASCIIAs16,
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (size_t i = 0; i < size_strings.size(); ++i) {
if (base::EqualsASCII(size_strings[i], "any")) {
*is_any = true;
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc ('k') | chrome/service/cloud_print/cloud_print_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698