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 "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 prefs::kNTPMostVisitedURLsBlacklist).Get(); | 157 prefs::kNTPMostVisitedURLsBlacklist).Get(); |
158 DictionaryPrefUpdate(profile_->GetPrefs(), | 158 DictionaryPrefUpdate(profile_->GetPrefs(), |
159 prefs::kNTPMostVisitedPinnedURLs).Get(); | 159 prefs::kNTPMostVisitedPinnedURLs).Get(); |
160 | 160 |
161 // Now the dictionaries are guaranteed to exist and we can cache pointers | 161 // Now the dictionaries are guaranteed to exist and we can cache pointers |
162 // to them. | 162 // to them. |
163 blacklist_ = | 163 blacklist_ = |
164 profile_->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedURLsBlacklist); | 164 profile_->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedURLsBlacklist); |
165 pinned_urls_ = | 165 pinned_urls_ = |
166 profile_->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedPinnedURLs); | 166 profile_->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedPinnedURLs); |
| 167 DCHECK(blacklist_ != NULL); |
| 168 DCHECK(pinned_urls_ != NULL); |
167 } | 169 } |
168 | 170 |
169 void TopSites::Init(const FilePath& db_name) { | 171 void TopSites::Init(const FilePath& db_name) { |
170 // Create the backend here, rather than in the constructor, so that | 172 // Create the backend here, rather than in the constructor, so that |
171 // unit tests that do not need the backend can run without a problem. | 173 // unit tests that do not need the backend can run without a problem. |
172 backend_ = new TopSitesBackend; | 174 backend_ = new TopSitesBackend; |
173 backend_->Init(db_name); | 175 backend_->Init(db_name); |
174 backend_->GetMostVisitedThumbnails( | 176 backend_->GetMostVisitedThumbnails( |
175 &top_sites_consumer_, | 177 &top_sites_consumer_, |
176 NewCallback(this, &TopSites::OnGotMostVisitedThumbnails)); | 178 NewCallback(this, &TopSites::OnGotMostVisitedThumbnails)); |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 SetTopSites(pages); | 1008 SetTopSites(pages); |
1007 | 1009 |
1008 // Used only in testing. | 1010 // Used only in testing. |
1009 NotificationService::current()->Notify( | 1011 NotificationService::current()->Notify( |
1010 chrome::NOTIFICATION_TOP_SITES_UPDATED, | 1012 chrome::NOTIFICATION_TOP_SITES_UPDATED, |
1011 Source<TopSites>(this), | 1013 Source<TopSites>(this), |
1012 Details<CancelableRequestProvider::Handle>(&handle)); | 1014 Details<CancelableRequestProvider::Handle>(&handle)); |
1013 } | 1015 } |
1014 | 1016 |
1015 } // namespace history | 1017 } // namespace history |
OLD | NEW |