| 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/dom_ui/most_visited_handler.h" | 5 #include "chrome/browser/dom_ui/most_visited_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 DOMMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) { | 68 DOMMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) { |
| 69 url_blacklist_ = dom_ui->GetProfile()->GetPrefs()-> | 69 url_blacklist_ = dom_ui->GetProfile()->GetPrefs()-> |
| 70 GetMutableDictionary(prefs::kNTPMostVisitedURLsBlacklist); | 70 GetMutableDictionary(prefs::kNTPMostVisitedURLsBlacklist); |
| 71 pinned_urls_ = dom_ui->GetProfile()->GetPrefs()-> | 71 pinned_urls_ = dom_ui->GetProfile()->GetPrefs()-> |
| 72 GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs); | 72 GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs); |
| 73 // Set up our sources for thumbnail and favicon data. | 73 // Set up our sources for thumbnail and favicon data. |
| 74 DOMUIThumbnailSource* thumbnail_src = | 74 DOMUIThumbnailSource* thumbnail_src = |
| 75 new DOMUIThumbnailSource(dom_ui->GetProfile()); | 75 new DOMUIThumbnailSource(dom_ui->GetProfile()); |
| 76 BrowserThread::PostTask( | 76 BrowserThread::PostTask( |
| 77 BrowserThread::IO, FROM_HERE, | 77 BrowserThread::IO, FROM_HERE, |
| 78 NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), | 78 NewRunnableMethod(ChromeURLDataManager::GetInstance(), |
| 79 &ChromeURLDataManager::AddDataSource, | 79 &ChromeURLDataManager::AddDataSource, |
| 80 make_scoped_refptr(thumbnail_src))); | 80 make_scoped_refptr(thumbnail_src))); |
| 81 | 81 |
| 82 DOMUIFavIconSource* favicon_src = | 82 DOMUIFavIconSource* favicon_src = |
| 83 new DOMUIFavIconSource(dom_ui->GetProfile()); | 83 new DOMUIFavIconSource(dom_ui->GetProfile()); |
| 84 BrowserThread::PostTask( | 84 BrowserThread::PostTask( |
| 85 BrowserThread::IO, FROM_HERE, | 85 BrowserThread::IO, FROM_HERE, |
| 86 NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), | 86 NewRunnableMethod(ChromeURLDataManager::GetInstance(), |
| 87 &ChromeURLDataManager::AddDataSource, | 87 &ChromeURLDataManager::AddDataSource, |
| 88 make_scoped_refptr(favicon_src))); | 88 make_scoped_refptr(favicon_src))); |
| 89 | 89 |
| 90 // Get notifications when history is cleared. | 90 // Get notifications when history is cleared. |
| 91 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, | 91 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, |
| 92 Source<Profile>(dom_ui->GetProfile())); | 92 Source<Profile>(dom_ui->GetProfile())); |
| 93 | 93 |
| 94 DOMMessageHandler* result = DOMMessageHandler::Attach(dom_ui); | 94 DOMMessageHandler* result = DOMMessageHandler::Attach(dom_ui); |
| 95 | 95 |
| 96 // We pre-emptively make a fetch for the most visited pages so we have the | 96 // We pre-emptively make a fetch for the most visited pages so we have the |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 // static | 551 // static |
| 552 std::vector<GURL> MostVisitedHandler::GetPrePopulatedUrls() { | 552 std::vector<GURL> MostVisitedHandler::GetPrePopulatedUrls() { |
| 553 const std::vector<MostVisitedPage> pages = | 553 const std::vector<MostVisitedPage> pages = |
| 554 MostVisitedHandler::GetPrePopulatedPages(); | 554 MostVisitedHandler::GetPrePopulatedPages(); |
| 555 std::vector<GURL> page_urls; | 555 std::vector<GURL> page_urls; |
| 556 for (size_t i = 0; i < pages.size(); ++i) | 556 for (size_t i = 0; i < pages.size(); ++i) |
| 557 page_urls.push_back(pages[i].url); | 557 page_urls.push_back(pages[i].url); |
| 558 return page_urls; | 558 return page_urls; |
| 559 } | 559 } |
| OLD | NEW |