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/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 Loading... |
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 URLRows copied_rows(rows); |
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 &copied_rows); |
2544 } | 2539 } |
2545 | 2540 |
2546 BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 2541 FOR_EACH_OBSERVER( |
2547 details.Pass()); | 2542 HistoryBackendObserver, observers_, |
| 2543 OnURLsDeleted(this, all_history, expired, copied_rows, favicon_urls)); |
| 2544 |
| 2545 // TODO(sdefresne): turn HistoryBackend::Delegate from HistoryService into |
| 2546 // an HistoryBackendObserver and register it so that we can remove this |
| 2547 // method. |
| 2548 if (delegate_) |
| 2549 delegate_->NotifyURLsDeleted(all_history, expired, copied_rows, |
| 2550 favicon_urls); |
2548 } | 2551 } |
2549 | 2552 |
2550 // Deleting -------------------------------------------------------------------- | 2553 // Deleting -------------------------------------------------------------------- |
2551 | 2554 |
2552 void HistoryBackend::DeleteAllHistory() { | 2555 void HistoryBackend::DeleteAllHistory() { |
2553 // Our approach to deleting all history is: | 2556 // Our approach to deleting all history is: |
2554 // 1. Copy the bookmarks and their dependencies to new tables with temporary | 2557 // 1. Copy the bookmarks and their dependencies to new tables with temporary |
2555 // names. | 2558 // names. |
2556 // 2. Delete the original tables. Since tables can not share pages, we know | 2559 // 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. | 2560 // 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 Loading... |
2691 info.url_id = visit.url_id; | 2694 info.url_id = visit.url_id; |
2692 info.time = visit.visit_time; | 2695 info.time = visit.visit_time; |
2693 info.transition = visit.transition; | 2696 info.transition = visit.transition; |
2694 // If we don't have a delegate yet during setup or shutdown, we will drop | 2697 // If we don't have a delegate yet during setup or shutdown, we will drop |
2695 // these notifications. | 2698 // these notifications. |
2696 if (delegate_) | 2699 if (delegate_) |
2697 delegate_->NotifyAddVisit(info); | 2700 delegate_->NotifyAddVisit(info); |
2698 } | 2701 } |
2699 | 2702 |
2700 } // namespace history | 2703 } // namespace history |
OLD | NEW |