summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/web_apps.cc
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-07-21 14:37:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-21 21:38:12 +0000
commitc6f82b158f374c172a46326699f03d97777faa8e (patch)
treec96472fa185ca20b22fad773cd195689e4097894 /chrome/renderer/web_apps.cc
parentdb484c3eff68c46ddf1530dd60441dba4614cb5c (diff)
downloadchromium_src-c6f82b158f374c172a46326699f03d97777faa8e.zip
chromium_src-c6f82b158f374c172a46326699f03d97777faa8e.tar.gz
chromium_src-c6f82b158f374c172a46326699f03d97777faa8e.tar.bz2
Update SplitString calls in chrome.
In many places that iterated over the results, the code was changed to use a range-based for loop over the result of the SplitStirng call. Review URL: https://codereview.chromium.org/1240183002 Cr-Commit-Position: refs/heads/master@{#339753}
Diffstat (limited to 'chrome/renderer/web_apps.cc')
-rw-r--r--chrome/renderer/web_apps.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/renderer/web_apps.cc b/chrome/renderer/web_apps.cc
index aadacca..95514bb 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;