Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/history/in_memory_history_backend.h

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove NotificationObserver from InMemoryURLIndex Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Deletes all search terms for the specified keyword. 67 // Deletes all search terms for the specified keyword.
68 void DeleteAllSearchTermsForKeyword(KeywordID keyword_id); 68 void DeleteAllSearchTermsForKeyword(KeywordID keyword_id);
69 69
70 // Returns the underlying database associated with this backend. The current 70 // Returns the underlying database associated with this backend. The current
71 // autocomplete code was written fro this, but it should probably be removed 71 // autocomplete code was written fro this, but it should probably be removed
72 // so that it can deal directly with this object, rather than the DB. 72 // so that it can deal directly with this object, rather than the DB.
73 InMemoryDatabase* db() const { 73 InMemoryDatabase* db() const {
74 return db_.get(); 74 return db_.get();
75 } 75 }
76 76
77 // Notification callback.
78 void Observe(int type,
79 const content::NotificationSource& source,
80 const content::NotificationDetails& details) override;
81
82 private:
83 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll);
84 FRIEND_TEST_ALL_PREFIXES(InMemoryHistoryBackendTest, OnURLsDeletedEnMasse);
85 friend class HistoryBackendTestBase;
86 friend class InMemoryHistoryBackendTest;
87
77 // HistoryServiceObserver: 88 // HistoryServiceObserver:
78 void OnURLVisited(HistoryService* history_service, 89 void OnURLVisited(HistoryService* history_service,
79 ui::PageTransition transition, 90 ui::PageTransition transition,
80 const URLRow& row, 91 const URLRow& row,
81 const RedirectList& redirects, 92 const RedirectList& redirects,
82 base::Time visit_time) override; 93 base::Time visit_time) override;
83 void OnURLsModified(HistoryService* history_service, 94 void OnURLsModified(HistoryService* history_service,
84 const URLRows& changed_urls) override; 95 const URLRows& changed_urls) override;
85 96 void OnURLsDeleted(HistoryService* history_service,
86 // Notification callback. 97 const URLsDeletedDetails& deleted_details) override;
87 void Observe(int type,
88 const content::NotificationSource& source,
89 const content::NotificationDetails& details) override;
90
91 private:
92 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.
98 void OnURLsDeleted(const URLsDeletedDetails& details);
99
100 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. 102 // Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED.
101 void OnKeywordSearchTermUpdated(const KeywordSearchUpdatedDetails& details); 103 void OnKeywordSearchTermUpdated(const KeywordSearchUpdatedDetails& details);
102 104
103 // Handler for HISTORY_KEYWORD_SEARCH_TERM_DELETED. 105 // Handler for HISTORY_KEYWORD_SEARCH_TERM_DELETED.
104 void OnKeywordSearchTermDeleted(const KeywordSearchDeletedDetails& details); 106 void OnKeywordSearchTermDeleted(const KeywordSearchDeletedDetails& details);
105 107
106 content::NotificationRegistrar registrar_; 108 content::NotificationRegistrar registrar_;
107 109
108 scoped_ptr<InMemoryDatabase> db_; 110 scoped_ptr<InMemoryDatabase> db_;
109 111
110 // The profile that this object is attached. May be NULL before 112 // The profile that this object is attached. May be NULL before
111 // initialization. 113 // initialization.
112 Profile* profile_; 114 Profile* profile_;
113 ScopedObserver<HistoryService, HistoryServiceObserver> 115 ScopedObserver<HistoryService, HistoryServiceObserver>
114 history_service_observer_; 116 history_service_observer_;
115 HistoryService* history_service_; 117 HistoryService* history_service_;
116 118
117 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); 119 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend);
118 }; 120 };
119 121
120 } // namespace history 122 } // namespace history
121 123
122 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ 124 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698