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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 first_recorded_time_ = visit_info.visit_time; | 803 first_recorded_time_ = visit_info.visit_time; |
804 | 804 |
805 // Broadcast a notification of the visit. | 805 // Broadcast a notification of the visit. |
806 if (visit_id) { | 806 if (visit_id) { |
807 RedirectList redirects; | 807 RedirectList redirects; |
808 // TODO(meelapshah) Disabled due to potential PageCycler regression. | 808 // TODO(meelapshah) Disabled due to potential PageCycler regression. |
809 // Re-enable this. | 809 // Re-enable this. |
810 // QueryRedirectsTo(url, &redirects); | 810 // QueryRedirectsTo(url, &redirects); |
811 NotifyURLVisited(transition, url_info, redirects, time); | 811 NotifyURLVisited(transition, url_info, redirects, time); |
812 } else { | 812 } else { |
813 VLOG(0) << "Failed to build visit insert statement: " | 813 DVLOG(0) << "Failed to build visit insert statement: " |
814 << "url_id = " << url_id; | 814 << "url_id = " << url_id; |
815 } | 815 } |
816 | 816 |
817 return std::make_pair(url_id, visit_id); | 817 return std::make_pair(url_id, visit_id); |
818 } | 818 } |
819 | 819 |
820 void HistoryBackend::AddPagesWithDetails(const URLRows& urls, | 820 void HistoryBackend::AddPagesWithDetails(const URLRows& urls, |
821 VisitSource visit_source) { | 821 VisitSource visit_source) { |
822 if (!db_) | 822 if (!db_) |
823 return; | 823 return; |
824 | 824 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 bool has_more_results = db_->GetVisibleVisitsInRange(options, &visits); | 1222 bool has_more_results = db_->GetVisibleVisitsInRange(options, &visits); |
1223 DCHECK(static_cast<int>(visits.size()) <= options.EffectiveMaxCount()); | 1223 DCHECK(static_cast<int>(visits.size()) <= options.EffectiveMaxCount()); |
1224 | 1224 |
1225 // Now add them and the URL rows to the results. | 1225 // Now add them and the URL rows to the results. |
1226 URLResult url_result; | 1226 URLResult url_result; |
1227 for (size_t i = 0; i < visits.size(); i++) { | 1227 for (size_t i = 0; i < visits.size(); i++) { |
1228 const VisitRow visit = visits[i]; | 1228 const VisitRow visit = visits[i]; |
1229 | 1229 |
1230 // Add a result row for this visit, get the URL info from the DB. | 1230 // Add a result row for this visit, get the URL info from the DB. |
1231 if (!db_->GetURLRow(visit.url_id, &url_result)) { | 1231 if (!db_->GetURLRow(visit.url_id, &url_result)) { |
1232 VLOG(0) << "Failed to get id " << visit.url_id | 1232 DVLOG(0) << "Failed to get id " << visit.url_id |
1233 << " from history.urls."; | 1233 << " from history.urls."; |
1234 continue; // DB out of sync and URL doesn't exist, try to recover. | 1234 continue; // DB out of sync and URL doesn't exist, try to recover. |
1235 } | 1235 } |
1236 | 1236 |
1237 if (!url_result.url().is_valid()) { | 1237 if (!url_result.url().is_valid()) { |
1238 VLOG(0) << "Got invalid URL from history.urls with id " | 1238 DVLOG(0) << "Got invalid URL from history.urls with id " |
1239 << visit.url_id << ": " | 1239 << visit.url_id << ": " |
1240 << url_result.url().possibly_invalid_spec(); | 1240 << url_result.url().possibly_invalid_spec(); |
1241 continue; // Don't report invalid URLs in case of corruption. | 1241 continue; // Don't report invalid URLs in case of corruption. |
1242 } | 1242 } |
1243 | 1243 |
1244 url_result.set_visit_time(visit.visit_time); | 1244 url_result.set_visit_time(visit.visit_time); |
1245 | 1245 |
1246 // Set whether the visit was blocked for a managed user by looking at the | 1246 // Set whether the visit was blocked for a managed user by looking at the |
1247 // transition type. | 1247 // transition type. |
1248 url_result.set_blocked_visit( | 1248 url_result.set_blocked_visit( |
1249 (visit.transition & ui::PAGE_TRANSITION_BLOCKED) != 0); | 1249 (visit.transition & ui::PAGE_TRANSITION_BLOCKED) != 0); |
1250 | 1250 |
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 int rank = kPageVisitStatsMaxTopSites; | 2730 int rank = kPageVisitStatsMaxTopSites; |
2731 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); | 2731 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); |
2732 if (it != most_visited_urls_map_.end()) | 2732 if (it != most_visited_urls_map_.end()) |
2733 rank = (*it).second; | 2733 rank = (*it).second; |
2734 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", | 2734 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", |
2735 rank, kPageVisitStatsMaxTopSites + 1); | 2735 rank, kPageVisitStatsMaxTopSites + 1); |
2736 } | 2736 } |
2737 #endif | 2737 #endif |
2738 | 2738 |
2739 } // namespace history | 2739 } // namespace history |
OLD | NEW |