Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_IN_MEMORY_URL_INDEX_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_IN_MEMORY_URL_INDEX_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_IN_MEMORY_URL_INDEX_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_IN_MEMORY_URL_INDEX_H_ |
| 7 | 7 |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| 20 #include "base/task/cancelable_task_tracker.h" | 20 #include "base/task/cancelable_task_tracker.h" |
| 21 #include "base/threading/sequenced_worker_pool.h" | |
| 22 #include "base/threading/thread_checker.h" | |
| 21 #include "chrome/browser/autocomplete/scored_history_match.h" | 23 #include "chrome/browser/autocomplete/scored_history_match.h" |
| 22 #include "components/history/core/browser/history_db_task.h" | 24 #include "components/history/core/browser/history_db_task.h" |
| 23 #include "components/history/core/browser/history_service_observer.h" | 25 #include "components/history/core/browser/history_service_observer.h" |
| 24 #include "components/history/core/browser/history_types.h" | 26 #include "components/history/core/browser/history_types.h" |
| 25 #include "components/keyed_service/core/keyed_service.h" | 27 #include "components/keyed_service/core/keyed_service.h" |
| 26 | 28 |
| 27 class HistoryQuickProviderTest; | 29 class HistoryQuickProviderTest; |
| 28 | 30 |
| 29 namespace base { | 31 namespace base { |
| 30 class SequencedTaskRunner; | 32 class SequencedTaskRunner; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 }; | 96 }; |
| 95 | 97 |
| 96 // |history_service| which may be null during unit testing is used to register | 98 // |history_service| which may be null during unit testing is used to register |
| 97 // |as an HistoryServiceObserver. |history_dir| is a path to the directory | 99 // |as an HistoryServiceObserver. |history_dir| is a path to the directory |
| 98 // containing the history database within the profile wherein the cache and | 100 // containing the history database within the profile wherein the cache and |
| 99 // transaction journals will be stored. |languages| gives a list of language | 101 // transaction journals will be stored. |languages| gives a list of language |
| 100 // encodings by which URLs and omnibox searches are broken down into words and | 102 // encodings by which URLs and omnibox searches are broken down into words and |
| 101 // characters. | 103 // characters. |
| 102 InMemoryURLIndex(bookmarks::BookmarkModel* bookmark_model, | 104 InMemoryURLIndex(bookmarks::BookmarkModel* bookmark_model, |
| 103 history::HistoryService* history_service, | 105 history::HistoryService* history_service, |
| 106 base::SequencedWorkerPool* worker_pool, | |
| 104 const base::FilePath& history_dir, | 107 const base::FilePath& history_dir, |
| 105 const std::string& languages); | 108 const std::string& languages, |
| 109 const std::set<std::string>& client_schemes_to_whitelist); | |
|
Peter Kasting
2015/06/16 22:18:07
I wonder if it makes sense to add a typedef for th
blundell
2015/06/17 07:55:44
Done.
| |
| 106 ~InMemoryURLIndex() override; | 110 ~InMemoryURLIndex() override; |
| 107 | 111 |
| 108 // Opens and prepares the index of historical URL visits. If the index private | 112 // Opens and prepares the index of historical URL visits. If the index private |
| 109 // data cannot be restored from its cache file then it is rebuilt from the | 113 // data cannot be restored from its cache file then it is rebuilt from the |
| 110 // history database. | 114 // history database. |
| 111 void Init(); | 115 void Init(); |
| 112 | 116 |
| 113 // Scans the history index and returns a vector with all scored, matching | 117 // Scans the history index and returns a vector with all scored, matching |
| 114 // history items. This entry point simply forwards the call on to the | 118 // history items. This entry point simply forwards the call on to the |
| 115 // URLIndexPrivateData class. For a complete description of this function | 119 // URLIndexPrivateData class. For a complete description of this function |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 // Set to true when changes to the index have been made and the index needs | 308 // Set to true when changes to the index have been made and the index needs |
| 305 // to be cached. Set to false when the index has been cached. Used as a | 309 // to be cached. Set to false when the index has been cached. Used as a |
| 306 // temporary safety check to insure that the cache is saved before the | 310 // temporary safety check to insure that the cache is saved before the |
| 307 // index has been destructed. | 311 // index has been destructed. |
| 308 bool needs_to_be_cached_; | 312 bool needs_to_be_cached_; |
| 309 | 313 |
| 310 // This flag is set to true if we want to listen to the | 314 // This flag is set to true if we want to listen to the |
| 311 // HistoryServiceLoaded Notification. | 315 // HistoryServiceLoaded Notification. |
| 312 bool listen_to_history_service_loaded_; | 316 bool listen_to_history_service_loaded_; |
| 313 | 317 |
| 318 base::ThreadChecker thread_checker_; | |
| 319 | |
| 314 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 320 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
| 315 }; | 321 }; |
| 316 | 322 |
| 317 #endif // CHROME_BROWSER_AUTOCOMPLETE_IN_MEMORY_URL_INDEX_H_ | 323 #endif // CHROME_BROWSER_AUTOCOMPLETE_IN_MEMORY_URL_INDEX_H_ |
| OLD | NEW |