OLD | NEW |
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 "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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 prefs::kNtpMostVisitedURLsBlacklist).Get(); | 163 prefs::kNtpMostVisitedURLsBlacklist).Get(); |
164 DictionaryPrefUpdate(profile_->GetPrefs(), | 164 DictionaryPrefUpdate(profile_->GetPrefs(), |
165 prefs::kNtpMostVisitedPinnedURLs).Get(); | 165 prefs::kNtpMostVisitedPinnedURLs).Get(); |
166 | 166 |
167 // Now the dictionaries are guaranteed to exist and we can cache pointers | 167 // Now the dictionaries are guaranteed to exist and we can cache pointers |
168 // to them. | 168 // to them. |
169 blacklist_ = | 169 blacklist_ = |
170 profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedURLsBlacklist); | 170 profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedURLsBlacklist); |
171 pinned_urls_ = | 171 pinned_urls_ = |
172 profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedPinnedURLs); | 172 profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedPinnedURLs); |
173 DCHECK(blacklist_ != NULL); | 173 CHECK(blacklist_ != NULL); |
174 DCHECK(pinned_urls_ != NULL); | 174 CHECK(pinned_urls_ != NULL); |
175 } | 175 } |
176 | 176 |
177 void TopSites::Init(const FilePath& db_name) { | 177 void TopSites::Init(const FilePath& db_name) { |
178 // Create the backend here, rather than in the constructor, so that | 178 // Create the backend here, rather than in the constructor, so that |
179 // unit tests that do not need the backend can run without a problem. | 179 // unit tests that do not need the backend can run without a problem. |
180 backend_ = new TopSitesBackend; | 180 backend_ = new TopSitesBackend; |
181 backend_->Init(db_name); | 181 backend_->Init(db_name); |
182 backend_->GetMostVisitedThumbnails( | 182 backend_->GetMostVisitedThumbnails( |
183 &top_sites_consumer_, | 183 &top_sites_consumer_, |
184 base::Bind(&TopSites::OnGotMostVisitedThumbnails, | 184 base::Bind(&TopSites::OnGotMostVisitedThumbnails, |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 SetTopSites(pages); | 1037 SetTopSites(pages); |
1038 | 1038 |
1039 // Used only in testing. | 1039 // Used only in testing. |
1040 content::NotificationService::current()->Notify( | 1040 content::NotificationService::current()->Notify( |
1041 chrome::NOTIFICATION_TOP_SITES_UPDATED, | 1041 chrome::NOTIFICATION_TOP_SITES_UPDATED, |
1042 content::Source<TopSites>(this), | 1042 content::Source<TopSites>(this), |
1043 content::Details<CancelableRequestProvider::Handle>(&handle)); | 1043 content::Details<CancelableRequestProvider::Handle>(&handle)); |
1044 } | 1044 } |
1045 | 1045 |
1046 } // namespace history | 1046 } // namespace history |
OLD | NEW |