| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, | 146 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, |
| 147 NotificationService::AllSources()); | 147 NotificationService::AllSources()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 blacklist_ = profile_->GetPrefs()-> | 150 blacklist_ = profile_->GetPrefs()-> |
| 151 GetMutableDictionary(prefs::kNTPMostVisitedURLsBlacklist); | 151 GetMutableDictionary(prefs::kNTPMostVisitedURLsBlacklist); |
| 152 pinned_urls_ = profile_->GetPrefs()-> | 152 pinned_urls_ = profile_->GetPrefs()-> |
| 153 GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs); | 153 GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // static | |
| 157 bool TopSites::IsEnabled() { | |
| 158 std::string switch_value = | |
| 159 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 160 switches::kEnableTopSites); | |
| 161 return switch_value.empty() || switch_value == "true"; | |
| 162 } | |
| 163 | |
| 164 void TopSites::Init(const FilePath& db_name) { | 156 void TopSites::Init(const FilePath& db_name) { |
| 165 backend_->Init(db_name); | 157 backend_->Init(db_name); |
| 166 backend_->GetMostVisitedThumbnails( | 158 backend_->GetMostVisitedThumbnails( |
| 167 &cancelable_consumer_, | 159 &cancelable_consumer_, |
| 168 NewCallback(this, &TopSites::OnGotMostVisitedThumbnails)); | 160 NewCallback(this, &TopSites::OnGotMostVisitedThumbnails)); |
| 169 | 161 |
| 170 // History may have already finished loading by the time we're created. | 162 // History may have already finished loading by the time we're created. |
| 171 HistoryService* history = profile_->GetHistoryServiceWithoutCreating(); | 163 HistoryService* history = profile_->GetHistoryServiceWithoutCreating(); |
| 172 if (history && history->backend_loaded()) { | 164 if (history && history->backend_loaded()) { |
| 173 if (history->needs_top_sites_migration()) | 165 if (history->needs_top_sites_migration()) |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 SetTopSites(pages); | 902 SetTopSites(pages); |
| 911 | 903 |
| 912 // Used only in testing. | 904 // Used only in testing. |
| 913 NotificationService::current()->Notify( | 905 NotificationService::current()->Notify( |
| 914 NotificationType::TOP_SITES_UPDATED, | 906 NotificationType::TOP_SITES_UPDATED, |
| 915 Source<TopSites>(this), | 907 Source<TopSites>(this), |
| 916 Details<CancelableRequestProvider::Handle>(&handle)); | 908 Details<CancelableRequestProvider::Handle>(&handle)); |
| 917 } | 909 } |
| 918 | 910 |
| 919 } // namespace history | 911 } // namespace history |
| OLD | NEW |