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

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

Issue 10096015: Single URL Expires Were Not Being Deleted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 if (!loaded_) 675 if (!loaded_)
676 return; 676 return;
677 677
678 if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { 678 if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) {
679 content::Details<history::URLsDeletedDetails> deleted_details(details); 679 content::Details<history::URLsDeletedDetails> deleted_details(details);
680 if (deleted_details->all_history) { 680 if (deleted_details->all_history) {
681 SetTopSites(MostVisitedURLList()); 681 SetTopSites(MostVisitedURLList());
682 backend_->ResetDatabase(); 682 backend_->ResetDatabase();
683 } else { 683 } else {
684 std::set<size_t> indices_to_delete; // Indices into top_sites_. 684 std::set<size_t> indices_to_delete; // Indices into top_sites_.
685 for (std::set<GURL>::iterator i = deleted_details->urls.begin(); 685 for (URLRows::const_iterator i = deleted_details->rows.begin();
686 i != deleted_details->urls.end(); ++i) { 686 i != deleted_details->rows.end(); ++i) {
687 if (cache_->IsKnownURL(*i)) 687 if (cache_->IsKnownURL(i->url()))
688 indices_to_delete.insert(cache_->GetURLIndex(*i)); 688 indices_to_delete.insert(cache_->GetURLIndex(i->url()));
689 } 689 }
690 690
691 if (indices_to_delete.empty()) 691 if (indices_to_delete.empty())
692 return; 692 return;
693 693
694 MostVisitedURLList new_top_sites(cache_->top_sites()); 694 MostVisitedURLList new_top_sites(cache_->top_sites());
695 for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin(); 695 for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin();
696 i != indices_to_delete.rend(); i++) { 696 i != indices_to_delete.rend(); i++) {
697 new_top_sites.erase(new_top_sites.begin() + *i); 697 new_top_sites.erase(new_top_sites.begin() + *i);
698 } 698 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 SetTopSites(pages); 893 SetTopSites(pages);
894 894
895 // Used only in testing. 895 // Used only in testing.
896 content::NotificationService::current()->Notify( 896 content::NotificationService::current()->Notify(
897 chrome::NOTIFICATION_TOP_SITES_UPDATED, 897 chrome::NOTIFICATION_TOP_SITES_UPDATED,
898 content::Source<TopSites>(this), 898 content::Source<TopSites>(this),
899 content::Details<CancelableRequestProvider::Handle>(&handle)); 899 content::Details<CancelableRequestProvider::Handle>(&handle));
900 } 900 }
901 901
902 } // namespace history 902 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/shortcuts_backend.cc ('k') | chrome/browser/sync/glue/typed_url_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698