| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/history/top_sites.h" | 5 #include "chrome/browser/history/top_sites.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 return -1; | 273 return -1; |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) { | 276 bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) { |
| 277 // TODO(arv): This needs to get the data from some configurable place. | 277 // TODO(arv): This needs to get the data from some configurable place. |
| 278 // http://crbug.com/17630 | 278 // http://crbug.com/17630 |
| 279 bool added = false; | 279 bool added = false; |
| 280 GURL welcome_url(l10n_util::GetStringUTF8(IDS_CHROME_WELCOME_URL)); | 280 GURL welcome_url(l10n_util::GetStringUTF8(IDS_CHROME_WELCOME_URL)); |
| 281 if (urls->size() < kTopSitesNumber && IndexOf(*urls, welcome_url) == -1) { | 281 if (urls->size() < kTopSitesNumber && IndexOf(*urls, welcome_url) == -1) { |
| 282 MostVisitedURL url = { | 282 MostVisitedURL url( |
| 283 welcome_url, | 283 welcome_url, |
| 284 GURL("chrome://theme/IDR_NEWTAB_CHROME_WELCOME_PAGE_FAVICON"), | 284 GURL("chrome://theme/IDR_NEWTAB_CHROME_WELCOME_PAGE_FAVICON"), |
| 285 l10n_util::GetStringUTF16(IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE) | 285 l10n_util::GetStringUTF16(IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE)); |
| 286 }; | |
| 287 url.redirects.push_back(welcome_url); | 286 url.redirects.push_back(welcome_url); |
| 288 urls->push_back(url); | 287 urls->push_back(url); |
| 289 added = true; | 288 added = true; |
| 290 } | 289 } |
| 291 | 290 |
| 292 GURL themes_url(l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)); | 291 GURL themes_url(l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)); |
| 293 if (urls->size() < kTopSitesNumber && IndexOf(*urls, themes_url) == -1) { | 292 if (urls->size() < kTopSitesNumber && IndexOf(*urls, themes_url) == -1) { |
| 294 MostVisitedURL url = { | 293 MostVisitedURL url( |
| 295 themes_url, | 294 themes_url, |
| 296 GURL("chrome://theme/IDR_NEWTAB_THEMES_GALLERY_FAVICON"), | 295 GURL("chrome://theme/IDR_NEWTAB_THEMES_GALLERY_FAVICON"), |
| 297 l10n_util::GetStringUTF16(IDS_NEW_TAB_THEMES_GALLERY_PAGE_TITLE) | 296 l10n_util::GetStringUTF16(IDS_NEW_TAB_THEMES_GALLERY_PAGE_TITLE)); |
| 298 }; | |
| 299 url.redirects.push_back(themes_url); | 297 url.redirects.push_back(themes_url); |
| 300 urls->push_back(url); | 298 urls->push_back(url); |
| 301 added = true; | 299 added = true; |
| 302 } | 300 } |
| 303 | 301 |
| 304 return added; | 302 return added; |
| 305 } | 303 } |
| 306 | 304 |
| 307 void TopSites::MigratePinnedURLs() { | 305 void TopSites::MigratePinnedURLs() { |
| 308 std::map<GURL, size_t> tmp_map; | 306 std::map<GURL, size_t> tmp_map; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 886 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 889 db_.reset(new TopSitesDatabaseImpl()); | 887 db_.reset(new TopSitesDatabaseImpl()); |
| 890 file_util::Delete(db_path_, false); | 888 file_util::Delete(db_path_, false); |
| 891 if (!db_->Init(db_path_)) { | 889 if (!db_->Init(db_path_)) { |
| 892 NOTREACHED() << "Failed to initialize database."; | 890 NOTREACHED() << "Failed to initialize database."; |
| 893 return; | 891 return; |
| 894 } | 892 } |
| 895 } | 893 } |
| 896 | 894 |
| 897 } // namespace history | 895 } // namespace history |
| OLD | NEW |