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