| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 listens for notifications | 10 // operations can be completed synchronously. It listens for notifications |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // so that it can deal directly with this object, rather than the DB. | 63 // so that it can deal directly with this object, rather than the DB. |
| 64 InMemoryDatabase* db() const { | 64 InMemoryDatabase* db() const { |
| 65 return db_.get(); | 65 return db_.get(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Notification callback. | 68 // Notification callback. |
| 69 virtual void Observe(int type, | 69 virtual void Observe(int type, |
| 70 const NotificationSource& source, | 70 const NotificationSource& source, |
| 71 const NotificationDetails& details); | 71 const NotificationDetails& details); |
| 72 | 72 |
| 73 // Return the quick history index. | |
| 74 history::InMemoryURLIndex* InMemoryIndex() const { return index_.get(); } | |
| 75 | |
| 76 private: | 73 private: |
| 77 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll); | 74 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll); |
| 78 | 75 |
| 79 // Handler for NOTIFY_HISTORY_TYPED_URLS_MODIFIED. | 76 // Handler for NOTIFY_HISTORY_TYPED_URLS_MODIFIED. |
| 80 void OnTypedURLsModified(const URLsModifiedDetails& details); | 77 void OnTypedURLsModified(const URLsModifiedDetails& details); |
| 81 | 78 |
| 82 // Handler for NOTIFY_HISTORY_URLS_DELETED. | 79 // Handler for NOTIFY_HISTORY_URLS_DELETED. |
| 83 void OnURLsDeleted(const URLsDeletedDetails& details); | 80 void OnURLsDeleted(const URLsDeletedDetails& details); |
| 84 | 81 |
| 85 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. | 82 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. |
| 86 void OnKeywordSearchTermUpdated(const KeywordSearchTermDetails& details); | 83 void OnKeywordSearchTermUpdated(const KeywordSearchTermDetails& details); |
| 87 | 84 |
| 88 // Returns true if there is a keyword associated with the specified url. | 85 // Returns true if there is a keyword associated with the specified url. |
| 89 bool HasKeyword(const GURL& url); | 86 bool HasKeyword(const GURL& url); |
| 90 | 87 |
| 91 NotificationRegistrar registrar_; | 88 NotificationRegistrar registrar_; |
| 92 | 89 |
| 93 scoped_ptr<InMemoryDatabase> db_; | 90 scoped_ptr<InMemoryDatabase> db_; |
| 94 | 91 |
| 95 // The profile that this object is attached. May be NULL before | 92 // The profile that this object is attached. May be NULL before |
| 96 // initialization. | 93 // initialization. |
| 97 Profile* profile_; | 94 Profile* profile_; |
| 98 | 95 |
| 99 // The index used for quick history lookups. | |
| 100 scoped_ptr<history::InMemoryURLIndex> index_; | |
| 101 | |
| 102 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); | 96 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); |
| 103 }; | 97 }; |
| 104 | 98 |
| 105 } // namespace history | 99 } // namespace history |
| 106 | 100 |
| 107 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 101 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
| OLD | NEW |