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 // The InMemoryHistoryBackend is a wrapper around the in-memory URL database. | 5 // The InMemoryHistoryBackend is a wrapper around the in-memory URL database. |
| 6 // It maintains an in-memory cache of a subset of history that is required for | 6 // It maintains an in-memory cache of a subset of history that is required for |
| 7 // low-latency operations, such as in-line autocomplete. | 7 // low-latency operations, such as in-line autocomplete. |
| 8 // | 8 // |
| 9 // The in-memory cache provides the following guarantees: | 9 // The in-memory cache provides the following guarantees: |
| 10 // (1.) It will always contain URLRows that either have a |typed_count| > 0; or | 10 // (1.) It will always contain URLRows that either have a |typed_count| > 0; or |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 class HistoryService; | 34 class HistoryService; |
| 35 class Profile; | 35 class Profile; |
| 36 | 36 |
| 37 namespace base { | 37 namespace base { |
| 38 class FilePath; | 38 class FilePath; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace history { | 41 namespace history { |
| 42 | 42 |
| 43 class InMemoryDatabase; | 43 class InMemoryDatabase; |
| 44 struct KeywordSearchUpdatedDetails; | 44 struct KeywordSearchUpdatedDetails; |
|
sdefresne
2014/12/24 09:03:43
KeywordSearchUpdatedDetails is not used anywhere,
Abhishek
2014/12/24 19:39:41
Done.
| |
| 45 struct KeywordSearchDeletedDetails; | 45 struct KeywordSearchDeletedDetails; |
| 46 class URLDatabase; | 46 class URLDatabase; |
| 47 class URLRow; | 47 class URLRow; |
| 48 struct URLsDeletedDetails; | 48 struct URLsDeletedDetails; |
| 49 struct URLsModifiedDetails; | 49 struct URLsModifiedDetails; |
| 50 | 50 |
| 51 class InMemoryHistoryBackend : public HistoryServiceObserver, | 51 class InMemoryHistoryBackend : public HistoryServiceObserver, |
| 52 public content::NotificationObserver { | 52 public content::NotificationObserver { |
| 53 public: | 53 public: |
| 54 InMemoryHistoryBackend(); | 54 InMemoryHistoryBackend(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 75 } | 75 } |
| 76 | 76 |
| 77 // HistoryServiceObserver: | 77 // HistoryServiceObserver: |
| 78 void OnURLVisited(HistoryService* history_service, | 78 void OnURLVisited(HistoryService* history_service, |
| 79 ui::PageTransition transition, | 79 ui::PageTransition transition, |
| 80 const URLRow& row, | 80 const URLRow& row, |
| 81 const RedirectList& redirects, | 81 const RedirectList& redirects, |
| 82 base::Time visit_time) override; | 82 base::Time visit_time) override; |
| 83 void OnURLsModified(HistoryService* history_service, | 83 void OnURLsModified(HistoryService* history_service, |
| 84 const URLRows& changed_urls) override; | 84 const URLRows& changed_urls) override; |
| 85 | 85 |
|
sdefresne
2014/12/24 09:03:43
nit: remove empty line
Abhishek
2014/12/24 19:39:41
Done.
| |
| 86 void HistoryKeywordSearchTermUpdated(HistoryService* history_service, | |
| 87 const URLRow& row, | |
| 88 KeywordID keyword_id, | |
| 89 const base::string16& term) override; | |
| 90 | |
| 86 // Notification callback. | 91 // Notification callback. |
| 87 void Observe(int type, | 92 void Observe(int type, |
| 88 const content::NotificationSource& source, | 93 const content::NotificationSource& source, |
| 89 const content::NotificationDetails& details) override; | 94 const content::NotificationDetails& details) override; |
| 90 | 95 |
| 91 private: | 96 private: |
| 92 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll); | 97 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll); |
| 93 | 98 |
| 94 // Handler for HISTORY_URL_VISITED and HISTORY_URLS_MODIFIED. | 99 // Handler for HISTORY_URL_VISITED and HISTORY_URLS_MODIFIED. |
| 95 void OnURLVisitedOrModified(const URLRow& url_row); | 100 void OnURLVisitedOrModified(const URLRow& url_row); |
| 96 | 101 |
| 97 // Handler for HISTORY_URLS_DELETED. | 102 // Handler for HISTORY_URLS_DELETED. |
| 98 void OnURLsDeleted(const URLsDeletedDetails& details); | 103 void OnURLsDeleted(const URLsDeletedDetails& details); |
| 99 | 104 |
| 100 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. | 105 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. |
| 101 void OnKeywordSearchTermUpdated(const KeywordSearchUpdatedDetails& details); | 106 void OnKeywordSearchTermUpdated(const URLRow& row, |
| 107 KeywordID keyword_id, | |
| 108 const base::string16& term); | |
| 102 | 109 |
| 103 // Handler for HISTORY_KEYWORD_SEARCH_TERM_DELETED. | 110 // Handler for HISTORY_KEYWORD_SEARCH_TERM_DELETED. |
| 104 void OnKeywordSearchTermDeleted(const KeywordSearchDeletedDetails& details); | 111 void OnKeywordSearchTermDeleted(const KeywordSearchDeletedDetails& details); |
| 105 | 112 |
| 106 content::NotificationRegistrar registrar_; | 113 content::NotificationRegistrar registrar_; |
| 107 | 114 |
| 108 scoped_ptr<InMemoryDatabase> db_; | 115 scoped_ptr<InMemoryDatabase> db_; |
| 109 | 116 |
| 110 // The profile that this object is attached. May be NULL before | 117 // The profile that this object is attached. May be NULL before |
| 111 // initialization. | 118 // initialization. |
| 112 Profile* profile_; | 119 Profile* profile_; |
| 113 ScopedObserver<HistoryService, HistoryServiceObserver> | 120 ScopedObserver<HistoryService, HistoryServiceObserver> |
| 114 history_service_observer_; | 121 history_service_observer_; |
| 115 HistoryService* history_service_; | 122 HistoryService* history_service_; |
| 116 | 123 |
| 117 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); | 124 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 } // namespace history | 127 } // namespace history |
| 121 | 128 |
| 122 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 129 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
| OLD | NEW |