| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ExpireHistoryBackend (manages moving things from HistoryDatabase to | 73 ExpireHistoryBackend (manages moving things from HistoryDatabase to |
| 74 the ArchivedDatabase and deleting) | 74 the ArchivedDatabase and deleting) |
| 75 */ | 75 */ |
| 76 | 76 |
| 77 namespace history { | 77 namespace history { |
| 78 | 78 |
| 79 // How long we keep segment data for in days. Currently 3 months. | 79 // How long we keep segment data for in days. Currently 3 months. |
| 80 // This value needs to be greater or equal to | 80 // This value needs to be greater or equal to |
| 81 // MostVisitedModel::kMostVisitedScope but we don't want to introduce a direct | 81 // MostVisitedModel::kMostVisitedScope but we don't want to introduce a direct |
| 82 // dependency between MostVisitedModel and the history backend. | 82 // dependency between MostVisitedModel and the history backend. |
| 83 static const int kSegmentDataRetention = 90; | 83 const int kSegmentDataRetention = 90; |
| 84 | 84 |
| 85 // How long we'll wait to do a commit, so that things are batched together. | 85 // How long we'll wait to do a commit, so that things are batched together. |
| 86 static const int kCommitIntervalSeconds = 10; | 86 const int kCommitIntervalSeconds = 10; |
| 87 | 87 |
| 88 // The amount of time before we re-fetch the favicon. | 88 // The amount of time before we re-fetch the favicon. |
| 89 static const int kFaviconRefetchDays = 7; | 89 const int kFaviconRefetchDays = 7; |
| 90 | |
| 91 // GetSessionTabs returns all open tabs, or tabs closed kSessionCloseTimeWindow | |
| 92 // seconds ago. | |
| 93 static const int kSessionCloseTimeWindowSecs = 10; | |
| 94 | 90 |
| 95 // The maximum number of items we'll allow in the redirect list before | 91 // The maximum number of items we'll allow in the redirect list before |
| 96 // deleting some. | 92 // deleting some. |
| 97 static const int kMaxRedirectCount = 32; | 93 const int kMaxRedirectCount = 32; |
| 98 | 94 |
| 99 // The number of days old a history entry can be before it is considered "old" | 95 // The number of days old a history entry can be before it is considered "old" |
| 100 // and is archived. | 96 // and is archived. |
| 101 static const int kArchiveDaysThreshold = 90; | 97 const int kArchiveDaysThreshold = 90; |
| 102 | 98 |
| 103 #if defined(OS_ANDROID) | 99 #if defined(OS_ANDROID) |
| 104 // The maximum number of top sites to track when recording top page visit stats. | 100 // The maximum number of top sites to track when recording top page visit stats. |
| 105 static const size_t kPageVisitStatsMaxTopSites = 50; | 101 const size_t kPageVisitStatsMaxTopSites = 50; |
| 106 #endif | 102 #endif |
| 107 | 103 |
| 108 // Converts from PageUsageData to MostVisitedURL. |redirects| is a | 104 // Converts from PageUsageData to MostVisitedURL. |redirects| is a |
| 109 // list of redirects for this URL. Empty list means no redirects. | 105 // list of redirects for this URL. Empty list means no redirects. |
| 110 MostVisitedURL MakeMostVisitedURL(const PageUsageData& page_data, | 106 MostVisitedURL MakeMostVisitedURL(const PageUsageData& page_data, |
| 111 const RedirectList& redirects) { | 107 const RedirectList& redirects) { |
| 112 MostVisitedURL mv; | 108 MostVisitedURL mv; |
| 113 mv.url = page_data.GetURL(); | 109 mv.url = page_data.GetURL(); |
| 114 mv.title = page_data.GetTitle(); | 110 mv.title = page_data.GetTitle(); |
| 115 if (redirects.empty()) { | 111 if (redirects.empty()) { |
| (...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 int rank = kPageVisitStatsMaxTopSites; | 2884 int rank = kPageVisitStatsMaxTopSites; |
| 2889 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); | 2885 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); |
| 2890 if (it != most_visited_urls_map_.end()) | 2886 if (it != most_visited_urls_map_.end()) |
| 2891 rank = (*it).second; | 2887 rank = (*it).second; |
| 2892 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", | 2888 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", |
| 2893 rank, kPageVisitStatsMaxTopSites + 1); | 2889 rank, kPageVisitStatsMaxTopSites + 1); |
| 2894 } | 2890 } |
| 2895 #endif | 2891 #endif |
| 2896 | 2892 |
| 2897 } // namespace history | 2893 } // namespace history |
| OLD | NEW |