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

Side by Side Diff: components/history/core/browser/top_sites_database.cc

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/history/core/browser/top_sites_database.h" 5 #include "components/history/core/browser/top_sites_database.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 "load_completed INTEGER DEFAULT 0," 78 "load_completed INTEGER DEFAULT 0,"
79 "last_forced INTEGER DEFAULT 0)"; 79 "last_forced INTEGER DEFAULT 0)";
80 return db->Execute(kThumbnailsSql); 80 return db->Execute(kThumbnailsSql);
81 } 81 }
82 82
83 // Encodes redirects into a string. 83 // Encodes redirects into a string.
84 std::string GetRedirects(const MostVisitedURL& url) { 84 std::string GetRedirects(const MostVisitedURL& url) {
85 std::vector<std::string> redirects; 85 std::vector<std::string> redirects;
86 for (size_t i = 0; i < url.redirects.size(); i++) 86 for (size_t i = 0; i < url.redirects.size(); i++)
87 redirects.push_back(url.redirects[i].spec()); 87 redirects.push_back(url.redirects[i].spec());
88 return JoinString(redirects, ' '); 88 return base::JoinString(redirects, " ");
89 } 89 }
90 90
91 // Decodes redirects from a string and sets them for the url. 91 // Decodes redirects from a string and sets them for the url.
92 void SetRedirects(const std::string& redirects, MostVisitedURL* url) { 92 void SetRedirects(const std::string& redirects, MostVisitedURL* url) {
93 std::vector<std::string> redirects_vector; 93 std::vector<std::string> redirects_vector;
94 base::SplitStringAlongWhitespace(redirects, &redirects_vector); 94 base::SplitStringAlongWhitespace(redirects, &redirects_vector);
95 for (size_t i = 0; i < redirects_vector.size(); ++i) { 95 for (size_t i = 0; i < redirects_vector.size(); ++i) {
96 GURL redirects_url(redirects_vector[i]); 96 GURL redirects_url(redirects_vector[i]);
97 if (redirects_url.is_valid()) 97 if (redirects_url.is_valid())
98 url->redirects.push_back(redirects_url); 98 url->redirects.push_back(redirects_url);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 db->set_error_callback(base::Bind(&DatabaseErrorCallback, db.get(), db_name)); 723 db->set_error_callback(base::Bind(&DatabaseErrorCallback, db.get(), db_name));
724 db->set_page_size(4096); 724 db->set_page_size(4096);
725 db->set_cache_size(32); 725 db->set_cache_size(32);
726 726
727 if (!db->Open(db_name)) 727 if (!db->Open(db_name))
728 return NULL; 728 return NULL;
729 return db.release(); 729 return db.release();
730 } 730 }
731 731
732 } // namespace history 732 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698