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 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2531 OnURLVisited(this, transition, url_info, redirects, visit_time)); | 2531 OnURLVisited(this, transition, url_info, redirects, visit_time)); |
2532 | 2532 |
2533 // TODO(sdefresne): turn HistoryBackend::Delegate from HistoryService into | 2533 // TODO(sdefresne): turn HistoryBackend::Delegate from HistoryService into |
2534 // an HistoryBackendObserver and register it so that we can remove this | 2534 // an HistoryBackendObserver and register it so that we can remove this |
2535 // method. | 2535 // method. |
2536 if (delegate_) | 2536 if (delegate_) |
2537 delegate_->NotifyURLVisited(transition, url_info, redirects, visit_time); | 2537 delegate_->NotifyURLVisited(transition, url_info, redirects, visit_time); |
2538 } | 2538 } |
2539 | 2539 |
2540 void HistoryBackend::NotifyURLsModified(const URLRows& rows) { | 2540 void HistoryBackend::NotifyURLsModified(const URLRows& rows) { |
2541 scoped_ptr<URLsModifiedDetails> details(new URLsModifiedDetails); | 2541 URLRows changed_urls(rows); |
2542 details->changed_urls = rows; | 2542 if (typed_url_syncable_service_.get()) |
| 2543 typed_url_syncable_service_->OnUrlsModified(&changed_urls); |
2543 | 2544 |
2544 if (typed_url_syncable_service_.get()) | 2545 FOR_EACH_OBSERVER( |
2545 typed_url_syncable_service_->OnUrlsModified(&details->changed_urls); | 2546 HistoryBackendObserver, observers_, OnURLsModified(this, changed_urls)); |
2546 | 2547 |
2547 BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, | 2548 // TODO(sdefresne): turn HistoryBackend::Delegate from HistoryService into |
2548 details.Pass()); | 2549 // an HistoryBackendObserver and register it so that we can remove this |
| 2550 // method. |
| 2551 if (delegate_) |
| 2552 delegate_->NotifyURLsModified(changed_urls); |
2549 } | 2553 } |
2550 | 2554 |
2551 void HistoryBackend::NotifyURLsDeleted(bool all_history, | 2555 void HistoryBackend::NotifyURLsDeleted(bool all_history, |
2552 bool expired, | 2556 bool expired, |
2553 const URLRows& rows, | 2557 const URLRows& rows, |
2554 const std::set<GURL>& favicon_urls) { | 2558 const std::set<GURL>& favicon_urls) { |
2555 scoped_ptr<URLsDeletedDetails> details(new URLsDeletedDetails); | 2559 scoped_ptr<URLsDeletedDetails> details(new URLsDeletedDetails); |
2556 details->all_history = all_history; | 2560 details->all_history = all_history; |
2557 details->expired = expired; | 2561 details->expired = expired; |
2558 details->rows = rows; | 2562 details->rows = rows; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 int rank = kPageVisitStatsMaxTopSites; | 2739 int rank = kPageVisitStatsMaxTopSites; |
2736 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); | 2740 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); |
2737 if (it != most_visited_urls_map_.end()) | 2741 if (it != most_visited_urls_map_.end()) |
2738 rank = (*it).second; | 2742 rank = (*it).second; |
2739 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", | 2743 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", |
2740 rank, kPageVisitStatsMaxTopSites + 1); | 2744 rank, kPageVisitStatsMaxTopSites + 1); |
2741 } | 2745 } |
2742 #endif | 2746 #endif |
2743 | 2747 |
2744 } // namespace history | 2748 } // namespace history |
OLD | NEW |