Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/history/history_backend.cc

Issue 376703007: Change HistoryService::ScheduleAutocomplete interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/files/file_enumerator.h" 17 #include "base/files/file_enumerator.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/scoped_vector.h" 19 #include "base/memory/scoped_vector.h"
20 #include "base/message_loop/message_loop.h" 20 #include "base/message_loop/message_loop.h"
21 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
22 #include "base/rand_util.h" 22 #include "base/rand_util.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/time/time.h" 25 #include "base/time/time.h"
26 #include "chrome/browser/autocomplete/history_url_provider.h"
27 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
28 #include "chrome/browser/favicon/favicon_changed_details.h" 27 #include "chrome/browser/favicon/favicon_changed_details.h"
29 #include "chrome/browser/history/download_row.h" 28 #include "chrome/browser/history/download_row.h"
30 #include "chrome/browser/history/history_db_task.h" 29 #include "chrome/browser/history/history_db_task.h"
31 #include "chrome/browser/history/history_notifications.h" 30 #include "chrome/browser/history/history_notifications.h"
32 #include "chrome/browser/history/in_memory_history_backend.h" 31 #include "chrome/browser/history/in_memory_history_backend.h"
33 #include "chrome/browser/history/page_usage_data.h" 32 #include "chrome/browser/history/page_usage_data.h"
34 #include "chrome/browser/history/top_sites.h" 33 #include "chrome/browser/history/top_sites.h"
35 #include "chrome/browser/history/typed_url_syncable_service.h" 34 #include "chrome/browser/history/typed_url_syncable_service.h"
36 #include "chrome/browser/history/visit_filter.h" 35 #include "chrome/browser/history/visit_filter.h"
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 1532
1534 URLID to_url_id = db_->GetRowForURL(to_url, NULL); 1533 URLID to_url_id = db_->GetRowForURL(to_url, NULL);
1535 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL); 1534 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL);
1536 if (!cur_visit) 1535 if (!cur_visit)
1537 return false; // No visits for URL. 1536 return false; // No visits for URL.
1538 1537
1539 GetRedirectsToSpecificVisit(cur_visit, redirects); 1538 GetRedirectsToSpecificVisit(cur_visit, redirects);
1540 return true; 1539 return true;
1541 } 1540 }
1542 1541
1543 void HistoryBackend::ScheduleAutocomplete(HistoryURLProvider* provider, 1542 void HistoryBackend::ScheduleAutocomplete(const base::Callback<
1544 HistoryURLProviderParams* params) { 1543 void(history::HistoryBackend*, history::URLDatabase*)>& callback) {
1545 // ExecuteWithDB should handle the NULL database case. 1544 // ExecuteWithDB should handle the NULL database case.
blundell 2014/07/08 09:10:05 This comment is out of date now; instead, the comm
nshaik 2014/07/08 18:53:49 Done.
1546 provider->ExecuteWithDB(this, db_.get(), params); 1545 callback.Run(this, db_.get());
1547 } 1546 }
1548 1547
1549 void HistoryBackend::DeleteFTSIndexDatabases() { 1548 void HistoryBackend::DeleteFTSIndexDatabases() {
1550 // Find files on disk matching the text databases file pattern so we can 1549 // Find files on disk matching the text databases file pattern so we can
1551 // quickly test for and delete them. 1550 // quickly test for and delete them.
1552 base::FilePath::StringType filepattern = 1551 base::FilePath::StringType filepattern =
1553 FILE_PATH_LITERAL("History Index *"); 1552 FILE_PATH_LITERAL("History Index *");
1554 base::FileEnumerator enumerator( 1553 base::FileEnumerator enumerator(
1555 history_dir_, false, base::FileEnumerator::FILES, filepattern); 1554 history_dir_, false, base::FileEnumerator::FILES, filepattern);
1556 int num_databases_deleted = 0; 1555 int num_databases_deleted = 0;
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2831 int rank = kPageVisitStatsMaxTopSites; 2830 int rank = kPageVisitStatsMaxTopSites;
2832 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2831 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2833 if (it != most_visited_urls_map_.end()) 2832 if (it != most_visited_urls_map_.end())
2834 rank = (*it).second; 2833 rank = (*it).second;
2835 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2834 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2836 rank, kPageVisitStatsMaxTopSites + 1); 2835 rank, kPageVisitStatsMaxTopSites + 1);
2837 } 2836 }
2838 #endif 2837 #endif
2839 2838
2840 } // namespace history 2839 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698