Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: chrome/browser/history/top_sites_impl.cc

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra inclusion from testing_profile.h Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_impl.h" 5 #include "chrome/browser/history/top_sites_impl.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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 { 366 {
367 DictionaryPrefUpdate update(profile_->GetPrefs(), 367 DictionaryPrefUpdate update(profile_->GetPrefs(),
368 prefs::kNtpMostVisitedURLsBlacklist); 368 prefs::kNtpMostVisitedURLsBlacklist);
369 base::DictionaryValue* blacklist = update.Get(); 369 base::DictionaryValue* blacklist = update.Get();
370 blacklist->Clear(); 370 blacklist->Clear();
371 } 371 }
372 ResetThreadSafeCache(); 372 ResetThreadSafeCache();
373 NotifyTopSitesChanged(); 373 NotifyTopSitesChanged();
374 } 374 }
375 375
376 void TopSitesImpl::Shutdown() { 376 void TopSitesImpl::ShutdownOnUIThread() {
377 profile_ = NULL; 377 profile_ = NULL;
378 // Cancel all requests so that the service doesn't callback to us after we've 378 // Cancel all requests so that the service doesn't callback to us after we've
379 // invoked Shutdown (this could happen if we have a pending request and 379 // invoked Shutdown (this could happen if we have a pending request and
380 // Shutdown is invoked). 380 // Shutdown is invoked).
381 cancelable_task_tracker_.TryCancelAll(); 381 cancelable_task_tracker_.TryCancelAll();
382 backend_->Shutdown(); 382 registrar_.RemoveAll();
383 if (backend_)
384 backend_->Shutdown();
383 } 385 }
384 386
385 // static 387 // static
386 void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, 388 void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list,
387 const MostVisitedURLList& new_list, 389 const MostVisitedURLList& new_list,
388 TopSitesDelta* delta) { 390 TopSitesDelta* delta) {
389 391
390 // Add all the old URLs for quick lookup. This maps URLs to the corresponding 392 // Add all the old URLs for quick lookup. This maps URLs to the corresponding
391 // index in the input. 393 // index in the input.
392 std::map<GURL, size_t> all_old_urls; 394 std::map<GURL, size_t> all_old_urls;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); 921 base::TimeDelta::FromSeconds(kUpdateIntervalSecs));
920 } 922 }
921 923
922 void TopSitesImpl::OnTopSitesAvailableFromHistory( 924 void TopSitesImpl::OnTopSitesAvailableFromHistory(
923 const MostVisitedURLList* pages) { 925 const MostVisitedURLList* pages) {
924 DCHECK(pages); 926 DCHECK(pages);
925 SetTopSites(*pages); 927 SetTopSites(*pages);
926 } 928 }
927 929
928 } // namespace history 930 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_impl.h ('k') | chrome/browser/history/top_sites_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698