| 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 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 } | 2675 } |
| 2676 | 2676 |
| 2677 void HistoryBackend::NotifyVisitObservers(const VisitRow& visit) { | 2677 void HistoryBackend::NotifyVisitObservers(const VisitRow& visit) { |
| 2678 BriefVisitInfo info; | 2678 BriefVisitInfo info; |
| 2679 info.url_id = visit.url_id; | 2679 info.url_id = visit.url_id; |
| 2680 info.time = visit.visit_time; | 2680 info.time = visit.visit_time; |
| 2681 info.transition = visit.transition; | 2681 info.transition = visit.transition; |
| 2682 // If we don't have a delegate yet during setup or shutdown, we will drop | 2682 // If we don't have a delegate yet during setup or shutdown, we will drop |
| 2683 // these notifications. | 2683 // these notifications. |
| 2684 if (delegate_) | 2684 if (delegate_) |
| 2685 delegate_->NotifyVisitDBObserversOnAddVisit(info); | 2685 delegate_->NotifyAddVisit(info); |
| 2686 } | 2686 } |
| 2687 | 2687 |
| 2688 #if defined(OS_ANDROID) | 2688 #if defined(OS_ANDROID) |
| 2689 void HistoryBackend::PopulateMostVisitedURLMap() { | 2689 void HistoryBackend::PopulateMostVisitedURLMap() { |
| 2690 MostVisitedURLList most_visited_urls; | 2690 MostVisitedURLList most_visited_urls; |
| 2691 QueryMostVisitedURLs( | 2691 QueryMostVisitedURLs( |
| 2692 kPageVisitStatsMaxTopSites, kSegmentDataRetention, &most_visited_urls); | 2692 kPageVisitStatsMaxTopSites, kSegmentDataRetention, &most_visited_urls); |
| 2693 | 2693 |
| 2694 DCHECK_LE(most_visited_urls.size(), kPageVisitStatsMaxTopSites); | 2694 DCHECK_LE(most_visited_urls.size(), kPageVisitStatsMaxTopSites); |
| 2695 for (size_t i = 0; i < most_visited_urls.size(); ++i) { | 2695 for (size_t i = 0; i < most_visited_urls.size(); ++i) { |
| 2696 most_visited_urls_map_[most_visited_urls[i].url] = i; | 2696 most_visited_urls_map_[most_visited_urls[i].url] = i; |
| 2697 for (size_t j = 0; j < most_visited_urls[i].redirects.size(); ++j) | 2697 for (size_t j = 0; j < most_visited_urls[i].redirects.size(); ++j) |
| 2698 most_visited_urls_map_[most_visited_urls[i].redirects[j]] = i; | 2698 most_visited_urls_map_[most_visited_urls[i].redirects[j]] = i; |
| 2699 } | 2699 } |
| 2700 } | 2700 } |
| 2701 | 2701 |
| 2702 void HistoryBackend::RecordTopPageVisitStats(const GURL& url) { | 2702 void HistoryBackend::RecordTopPageVisitStats(const GURL& url) { |
| 2703 int rank = kPageVisitStatsMaxTopSites; | 2703 int rank = kPageVisitStatsMaxTopSites; |
| 2704 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); | 2704 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); |
| 2705 if (it != most_visited_urls_map_.end()) | 2705 if (it != most_visited_urls_map_.end()) |
| 2706 rank = (*it).second; | 2706 rank = (*it).second; |
| 2707 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", | 2707 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", |
| 2708 rank, kPageVisitStatsMaxTopSites + 1); | 2708 rank, kPageVisitStatsMaxTopSites + 1); |
| 2709 } | 2709 } |
| 2710 #endif | 2710 #endif |
| 2711 | 2711 |
| 2712 } // namespace history | 2712 } // namespace history |
| OLD | NEW |