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

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

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove NotificationObserver from InMemoryURLIndex Created 6 years 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) 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/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 // an HistoryBackendObserver and register it so that we can remove this 2525 // an HistoryBackendObserver and register it so that we can remove this
2526 // method. 2526 // method.
2527 if (delegate_) 2527 if (delegate_)
2528 delegate_->NotifyURLsModified(changed_urls); 2528 delegate_->NotifyURLsModified(changed_urls);
2529 } 2529 }
2530 2530
2531 void HistoryBackend::NotifyURLsDeleted(bool all_history, 2531 void HistoryBackend::NotifyURLsDeleted(bool all_history,
2532 bool expired, 2532 bool expired,
2533 const URLRows& rows, 2533 const URLRows& rows,
2534 const std::set<GURL>& favicon_urls) { 2534 const std::set<GURL>& favicon_urls) {
2535 scoped_ptr<URLsDeletedDetails> details(new URLsDeletedDetails); 2535 const URLsDeletedDetails details(all_history, expired, rows, favicon_urls);
2536 details->all_history = all_history;
2537 details->expired = expired;
2538 details->rows = rows;
2539 details->favicon_urls = favicon_urls;
2540
2541 if (typed_url_syncable_service_.get()) { 2536 if (typed_url_syncable_service_.get()) {
2542 typed_url_syncable_service_->OnUrlsDeleted( 2537 typed_url_syncable_service_->OnUrlsDeleted(all_history, expired,
2543 all_history, expired, &details->rows); 2538 const_cast<URLRows*>(&rows));
sdefresne 2014/12/04 17:21:12 Do *not* use const_cast, instead copy rows into a
nshaik 2014/12/07 09:34:49 Done.
2544 } 2539 }
2545 2540
2546 BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_DELETED, 2541 FOR_EACH_OBSERVER(HistoryBackendObserver, observers_,
2547 details.Pass()); 2542 OnURLsDeleted(this, details));
2543
2544 // TODO(sdefresne): turn HistoryBackend::Delegate from HistoryService into
2545 // an HistoryBackendObserver and register it so that we can remove this
2546 // method.
2547 if (delegate_)
2548 delegate_->NotifyURLsDeleted(details);
2548 } 2549 }
2549 2550
2550 // Deleting -------------------------------------------------------------------- 2551 // Deleting --------------------------------------------------------------------
2551 2552
2552 void HistoryBackend::DeleteAllHistory() { 2553 void HistoryBackend::DeleteAllHistory() {
2553 // Our approach to deleting all history is: 2554 // Our approach to deleting all history is:
2554 // 1. Copy the bookmarks and their dependencies to new tables with temporary 2555 // 1. Copy the bookmarks and their dependencies to new tables with temporary
2555 // names. 2556 // names.
2556 // 2. Delete the original tables. Since tables can not share pages, we know 2557 // 2. Delete the original tables. Since tables can not share pages, we know
2557 // that any data we don't want to keep is now in an unused page. 2558 // that any data we don't want to keep is now in an unused page.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2691 info.url_id = visit.url_id; 2692 info.url_id = visit.url_id;
2692 info.time = visit.visit_time; 2693 info.time = visit.visit_time;
2693 info.transition = visit.transition; 2694 info.transition = visit.transition;
2694 // If we don't have a delegate yet during setup or shutdown, we will drop 2695 // If we don't have a delegate yet during setup or shutdown, we will drop
2695 // these notifications. 2696 // these notifications.
2696 if (delegate_) 2697 if (delegate_)
2697 delegate_->NotifyAddVisit(info); 2698 delegate_->NotifyAddVisit(info);
2698 } 2699 }
2699 2700
2700 } // namespace history 2701 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698