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