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_HISTORY_IN_MEMORY_URL_INDEX_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 6 #define CHROME_BROWSER_HISTORY_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 "chrome/browser/history/history_db_task.h" | 21 #include "chrome/browser/history/history_db_task.h" |
| 22 #include "chrome/browser/history/history_service.h" |
22 #include "chrome/browser/history/in_memory_url_index_types.h" | 23 #include "chrome/browser/history/in_memory_url_index_types.h" |
23 #include "chrome/browser/history/scored_history_match.h" | 24 #include "chrome/browser/history/scored_history_match.h" |
24 #include "components/history/core/browser/history_service_observer.h" | |
25 #include "components/history/core/browser/history_types.h" | 25 #include "components/history/core/browser/history_types.h" |
26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
28 #include "sql/connection.h" | 28 #include "sql/connection.h" |
29 | 29 |
30 class HistoryService; | |
31 class HistoryQuickProviderTest; | 30 class HistoryQuickProviderTest; |
32 class Profile; | 31 class Profile; |
33 | 32 |
34 namespace base { | 33 namespace base { |
35 class Time; | 34 class Time; |
36 } | 35 } |
37 | 36 |
38 namespace in_memory_url_index { | 37 namespace in_memory_url_index { |
39 class InMemoryURLIndexCacheItem; | 38 class InMemoryURLIndexCacheItem; |
40 } | 39 } |
(...skipping 21 matching lines...) Expand all Loading... |
62 // words and characters in the URL history database except when converting | 61 // words and characters in the URL history database except when converting |
63 // URL strings to lowercase. Multi-byte-edness makes no difference when | 62 // URL strings to lowercase. Multi-byte-edness makes no difference when |
64 // indexing or when searching the index as the final filtering of results | 63 // indexing or when searching the index as the final filtering of results |
65 // is dependent on the comparison of a string of bytes, not individual | 64 // is dependent on the comparison of a string of bytes, not individual |
66 // characters. While the lookup of those bytes during a search in the | 65 // characters. While the lookup of those bytes during a search in the |
67 // |char_word_map_| could serve up words in which the individual char16 | 66 // |char_word_map_| could serve up words in which the individual char16 |
68 // occurs as a portion of a composite character the next filtering step | 67 // occurs as a portion of a composite character the next filtering step |
69 // will eliminate such words except in the case where a single character | 68 // will eliminate such words except in the case where a single character |
70 // is being searched on and which character occurs as the second char16 of a | 69 // is being searched on and which character occurs as the second char16 of a |
71 // multi-char16 instance. | 70 // multi-char16 instance. |
72 class InMemoryURLIndex : public HistoryServiceObserver, | 71 class InMemoryURLIndex : public HistoryService::Observer, |
73 public content::NotificationObserver, | 72 public content::NotificationObserver, |
74 public base::SupportsWeakPtr<InMemoryURLIndex> { | 73 public base::SupportsWeakPtr<InMemoryURLIndex> { |
75 public: | 74 public: |
76 // Defines an abstract class which is notified upon completion of restoring | 75 // Defines an abstract class which is notified upon completion of restoring |
77 // the index's private data either by reading from the cache file or by | 76 // the index's private data either by reading from the cache file or by |
78 // rebuilding from the history database. | 77 // rebuilding from the history database. |
79 class RestoreCacheObserver { | 78 class RestoreCacheObserver { |
80 public: | 79 public: |
81 virtual ~RestoreCacheObserver(); | 80 virtual ~RestoreCacheObserver(); |
82 | 81 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 232 |
234 // Notifies the observer, if any, of the success of the private data caching. | 233 // Notifies the observer, if any, of the success of the private data caching. |
235 // |succeeded| is true on a successful save. | 234 // |succeeded| is true on a successful save. |
236 void OnCacheSaveDone(bool succeeded); | 235 void OnCacheSaveDone(bool succeeded); |
237 | 236 |
238 // Handles notifications of history changes. | 237 // Handles notifications of history changes. |
239 virtual void Observe(int notification_type, | 238 virtual void Observe(int notification_type, |
240 const content::NotificationSource& source, | 239 const content::NotificationSource& source, |
241 const content::NotificationDetails& details) OVERRIDE; | 240 const content::NotificationDetails& details) OVERRIDE; |
242 | 241 |
243 // HistoryServiceObserver: | 242 // HistoryService::Observer: |
244 virtual void OnURLVisited(ui::PageTransition transition, | 243 virtual void OnURLVisited(ui::PageTransition transition, |
245 const URLRow& row, | 244 const URLRow& row, |
246 const RedirectList& redirects, | 245 const RedirectList& redirects, |
247 base::Time visit_time) OVERRIDE; | 246 base::Time visit_time) OVERRIDE; |
248 | 247 |
249 // Notification handlers. | 248 // Notification handlers. |
250 void OnURLsModified(const URLsModifiedDetails* details); | 249 void OnURLsModified(const URLsModifiedDetails* details); |
251 void OnURLsDeleted(const URLsDeletedDetails* details); | 250 void OnURLsDeleted(const URLsDeletedDetails* details); |
252 | 251 |
253 // Sets the directory wherein the cache file will be maintained. | 252 // Sets the directory wherein the cache file will be maintained. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // temporary safety check to insure that the cache is saved before the | 307 // temporary safety check to insure that the cache is saved before the |
309 // index has been destructed. | 308 // index has been destructed. |
310 bool needs_to_be_cached_; | 309 bool needs_to_be_cached_; |
311 | 310 |
312 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 311 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
313 }; | 312 }; |
314 | 313 |
315 } // namespace history | 314 } // namespace history |
316 | 315 |
317 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 316 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
OLD | NEW |