| 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 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 | 1314 |
| 1315 URLID to_url_id = db_->GetRowForURL(to_url, NULL); | 1315 URLID to_url_id = db_->GetRowForURL(to_url, NULL); |
| 1316 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL); | 1316 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL); |
| 1317 if (!cur_visit) | 1317 if (!cur_visit) |
| 1318 return; // No visits for URL. | 1318 return; // No visits for URL. |
| 1319 | 1319 |
| 1320 GetRedirectsToSpecificVisit(cur_visit, redirects); | 1320 GetRedirectsToSpecificVisit(cur_visit, redirects); |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 void HistoryBackend::GetVisibleVisitCountToHost( | 1323 void HistoryBackend::GetVisibleVisitCountToHost( |
| 1324 const GURL& url, | 1324 scoped_refptr<GetVisibleVisitCountToHostRequest> request, |
| 1325 VisibleVisitCountToHostResult* result) { | 1325 const GURL& url) { |
| 1326 result->count = 0; | 1326 if (request->canceled()) |
| 1327 result->success = db_.get() && | 1327 return; |
| 1328 db_->GetVisibleVisitCountToHost( | 1328 int count = 0; |
| 1329 url, &result->count, &result->first_visit); | 1329 Time first_visit; |
| 1330 const bool success = db_.get() && |
| 1331 db_->GetVisibleVisitCountToHost(url, &count, &first_visit); |
| 1332 request->ForwardResult(request->handle(), success, count, first_visit); |
| 1330 } | 1333 } |
| 1331 | 1334 |
| 1332 void HistoryBackend::QueryTopURLsAndRedirects( | 1335 void HistoryBackend::QueryTopURLsAndRedirects( |
| 1333 scoped_refptr<QueryTopURLsAndRedirectsRequest> request, | 1336 scoped_refptr<QueryTopURLsAndRedirectsRequest> request, |
| 1334 int result_count) { | 1337 int result_count) { |
| 1335 if (request->canceled()) | 1338 if (request->canceled()) |
| 1336 return; | 1339 return; |
| 1337 | 1340 |
| 1338 if (!db_) { | 1341 if (!db_) { |
| 1339 request->ForwardResult(request->handle(), false, NULL, NULL); | 1342 request->ForwardResult(request->handle(), false, NULL, NULL); |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 int rank = kPageVisitStatsMaxTopSites; | 2813 int rank = kPageVisitStatsMaxTopSites; |
| 2811 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); | 2814 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); |
| 2812 if (it != most_visited_urls_map_.end()) | 2815 if (it != most_visited_urls_map_.end()) |
| 2813 rank = (*it).second; | 2816 rank = (*it).second; |
| 2814 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", | 2817 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", |
| 2815 rank, kPageVisitStatsMaxTopSites + 1); | 2818 rank, kPageVisitStatsMaxTopSites + 1); |
| 2816 } | 2819 } |
| 2817 #endif | 2820 #endif |
| 2818 | 2821 |
| 2819 } // namespace history | 2822 } // namespace history |
| OLD | NEW |