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

Side by Side Diff: chrome/browser/history/top_sites_database.cc

Issue 5004002: base: Move StringSplitAlongWhitespace to string_split.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittests Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/sql/connection.h" 5 #include "app/sql/connection.h"
6 #include "app/sql/transaction.h" 6 #include "app/sql/transaction.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_split.h"
8 #include "base/string_util.h" 9 #include "base/string_util.h"
9 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" 10 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
10 #include "chrome/browser/history/history_types.h" 11 #include "chrome/browser/history/history_types.h"
11 #include "chrome/browser/history/top_sites.h" 12 #include "chrome/browser/history/top_sites.h"
12 #include "chrome/browser/history/top_sites_database.h" 13 #include "chrome/browser/history/top_sites_database.h"
13 14
14 namespace history { 15 namespace history {
15 16
16 static const int kVersionNumber = 1; 17 static const int kVersionNumber = 1;
17 18
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 std::vector<std::string> redirects; 128 std::vector<std::string> redirects;
128 for (size_t i = 0; i < url.redirects.size(); i++) 129 for (size_t i = 0; i < url.redirects.size(); i++)
129 redirects.push_back(url.redirects[i].spec()); 130 redirects.push_back(url.redirects[i].spec());
130 return JoinString(redirects, ' '); 131 return JoinString(redirects, ' ');
131 } 132 }
132 133
133 // static 134 // static
134 void TopSitesDatabase::SetRedirects(const std::string& redirects, 135 void TopSitesDatabase::SetRedirects(const std::string& redirects,
135 MostVisitedURL* url) { 136 MostVisitedURL* url) {
136 std::vector<std::string> redirects_vector; 137 std::vector<std::string> redirects_vector;
137 SplitStringAlongWhitespace(redirects, &redirects_vector); 138 base::SplitStringAlongWhitespace(redirects, &redirects_vector);
138 for (size_t i = 0; i < redirects_vector.size(); i++) 139 for (size_t i = 0; i < redirects_vector.size(); ++i)
139 url->redirects.push_back(GURL(redirects_vector[i])); 140 url->redirects.push_back(GURL(redirects_vector[i]));
140 } 141 }
141 142
142 void TopSitesDatabase::SetPageThumbnail(const MostVisitedURL& url, 143 void TopSitesDatabase::SetPageThumbnail(const MostVisitedURL& url,
143 int new_rank, 144 int new_rank,
144 const Images& thumbnail) { 145 const Images& thumbnail) {
145 sql::Transaction transaction(db_.get()); 146 sql::Transaction transaction(db_.get());
146 transaction.Begin(); 147 transaction.Begin();
147 148
148 int rank = GetURLRank(url); 149 int rank = GetURLRank(url);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 371
371 if (!db->Open(db_name)) { 372 if (!db->Open(db_name)) {
372 LOG(ERROR) << db->GetErrorMessage(); 373 LOG(ERROR) << db->GetErrorMessage();
373 return NULL; 374 return NULL;
374 } 375 }
375 376
376 return db.release(); 377 return db.release();
377 } 378 }
378 379
379 } // namespace history 380 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_unittest.cc ('k') | chrome/browser/themes/browser_theme_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698