OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Contains the history backend wrapper around the in-memory URL database. This | 5 // Contains the history backend wrapper around the in-memory URL database. This |
6 // object maintains an in-memory cache of the subset of history required to do | 6 // object maintains an in-memory cache of the subset of history required to do |
7 // in-line autocomplete. | 7 // in-line autocomplete. |
8 // | 8 // |
9 // It is created on the history thread and passed to the main thread where | 9 // It is created on the history thread and passed to the main thread where |
10 // operations can be completed synchronously. It listenes for notifications | 10 // operations can be completed synchronously. It listenes for notifications |
11 // from the "regular" history backend and keeps itself in sync. | 11 // from the "regular" history backend and keeps itself in sync. |
12 | 12 |
13 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 13 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
14 #define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 14 #define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
15 #pragma once | 15 #pragma once |
16 | 16 |
17 #include <string> | 17 #include <string> |
18 | 18 |
19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
20 #include "base/gtest_prod_util.h" | 20 #include "base/gtest_prod_util.h" |
21 #include "base/scoped_ptr.h" | 21 #include "base/scoped_ptr.h" |
22 #include "chrome/common/notification_observer.h" | 22 #include "chrome/common/notification_observer.h" |
23 #include "chrome/common/notification_registrar.h" | 23 #include "chrome/common/notification_registrar.h" |
24 | 24 |
25 class FilePath; | 25 class FilePath; |
| 26 class GURL; |
26 class HistoryDatabase; | 27 class HistoryDatabase; |
27 class Profile; | 28 class Profile; |
28 | 29 |
29 namespace history { | 30 namespace history { |
30 | 31 |
31 class InMemoryDatabase; | 32 class InMemoryDatabase; |
32 class InMemoryURLIndex; | 33 class InMemoryURLIndex; |
33 struct KeywordSearchTermDetails; | 34 struct KeywordSearchTermDetails; |
34 class URLDatabase; | 35 class URLDatabase; |
35 struct URLsDeletedDetails; | 36 struct URLsDeletedDetails; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 71 |
71 // Handler for NOTIFY_HISTORY_TYPED_URLS_MODIFIED. | 72 // Handler for NOTIFY_HISTORY_TYPED_URLS_MODIFIED. |
72 void OnTypedURLsModified(const URLsModifiedDetails& details); | 73 void OnTypedURLsModified(const URLsModifiedDetails& details); |
73 | 74 |
74 // Handler for NOTIFY_HISTORY_URLS_DELETED. | 75 // Handler for NOTIFY_HISTORY_URLS_DELETED. |
75 void OnURLsDeleted(const URLsDeletedDetails& details); | 76 void OnURLsDeleted(const URLsDeletedDetails& details); |
76 | 77 |
77 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. | 78 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. |
78 void OnKeywordSearchTermUpdated(const KeywordSearchTermDetails& details); | 79 void OnKeywordSearchTermUpdated(const KeywordSearchTermDetails& details); |
79 | 80 |
| 81 // Returns true if there is a keyword associated with the specified url. |
| 82 bool HasKeyword(const GURL& url); |
| 83 |
80 NotificationRegistrar registrar_; | 84 NotificationRegistrar registrar_; |
81 | 85 |
82 scoped_ptr<InMemoryDatabase> db_; | 86 scoped_ptr<InMemoryDatabase> db_; |
83 | 87 |
84 // The profile that this object is attached. May be NULL before | 88 // The profile that this object is attached. May be NULL before |
85 // initialization. | 89 // initialization. |
86 Profile* profile_; | 90 Profile* profile_; |
87 | 91 |
88 // The index used for quick history lookups. | 92 // The index used for quick history lookups. |
89 scoped_ptr<history::InMemoryURLIndex> index_; | 93 scoped_ptr<history::InMemoryURLIndex> index_; |
90 | 94 |
91 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); | 95 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); |
92 }; | 96 }; |
93 | 97 |
94 } // namespace history | 98 } // namespace history |
95 | 99 |
96 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 100 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
OLD | NEW |