summaryrefslogtreecommitdiffstats
path: root/components/history
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-07-23 16:23:31 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-23 23:25:00 +0000
commit8be197d144c267c6a7c1b207a41267ac6c971712 (patch)
tree22d99a93dc2f060d8637abbea5fcc869cc602686 /components/history
parenta36acb95c375d4de17277cadbe8d56b45a80d5ce (diff)
downloadchromium_src-8be197d144c267c6a7c1b207a41267ac6c971712.zip
chromium_src-8be197d144c267c6a7c1b207a41267ac6c971712.tar.gz
chromium_src-8be197d144c267c6a7c1b207a41267ac6c971712.tar.bz2
Update SplitString calls in components
This converts calls from the old form to the new form. Some calls that iterated over the results were changed to a range-based for loop with an inline call to SplitString. Some places were changed to use StringPieces when it was safe to do so. Review URL: https://codereview.chromium.org/1234973004 Cr-Commit-Position: refs/heads/master@{#340209}
Diffstat (limited to 'components/history')
-rw-r--r--components/history/core/browser/top_sites_database.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/components/history/core/browser/top_sites_database.cc b/components/history/core/browser/top_sites_database.cc
index d1f024d..00c4559 100644
--- a/components/history/core/browser/top_sites_database.cc
+++ b/components/history/core/browser/top_sites_database.cc
@@ -90,12 +90,12 @@ std::string GetRedirects(const MostVisitedURL& url) {
// Decodes redirects from a string and sets them for the url.
void SetRedirects(const std::string& redirects, MostVisitedURL* url) {
- std::vector<std::string> redirects_vector;
- base::SplitStringAlongWhitespace(redirects, &redirects_vector);
- for (size_t i = 0; i < redirects_vector.size(); ++i) {
- GURL redirects_url(redirects_vector[i]);
- if (redirects_url.is_valid())
- url->redirects.push_back(redirects_url);
+ for (const std::string& redirect : base::SplitString(
+ redirects, base::kWhitespaceASCII,
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
+ GURL redirect_url(redirect);
+ if (redirect_url.is_valid())
+ url->redirects.push_back(redirect_url);
}
}