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

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

Issue 666673010: Standardize usage of virtual/override/final in chrome/browser/history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 struct KeywordSearchDeletedDetails; 44 struct KeywordSearchDeletedDetails;
45 class URLDatabase; 45 class URLDatabase;
46 class URLRow; 46 class URLRow;
47 struct URLsDeletedDetails; 47 struct URLsDeletedDetails;
48 struct URLsModifiedDetails; 48 struct URLsModifiedDetails;
49 49
50 class InMemoryHistoryBackend : public HistoryServiceObserver, 50 class InMemoryHistoryBackend : public HistoryServiceObserver,
51 public content::NotificationObserver { 51 public content::NotificationObserver {
52 public: 52 public:
53 InMemoryHistoryBackend(); 53 InMemoryHistoryBackend();
54 virtual ~InMemoryHistoryBackend(); 54 ~InMemoryHistoryBackend() override;
55 55
56 // Initializes the backend from the history database pointed to by the 56 // Initializes the backend from the history database pointed to by the
57 // full path in |history_filename|. 57 // full path in |history_filename|.
58 bool Init(const base::FilePath& history_filename); 58 bool Init(const base::FilePath& history_filename);
59 59
60 // Does initialization work when this object is attached to the history 60 // Does initialization work when this object is attached to the history
61 // system on the main thread. The argument is the profile with which the 61 // system on the main thread. The argument is the profile with which the
62 // attached history service is under. 62 // attached history service is under.
63 void AttachToHistoryService(Profile* profile, 63 void AttachToHistoryService(Profile* profile,
64 HistoryService* history_service); 64 HistoryService* history_service);
65 65
66 // Deletes all search terms for the specified keyword. 66 // Deletes all search terms for the specified keyword.
67 void DeleteAllSearchTermsForKeyword(KeywordID keyword_id); 67 void DeleteAllSearchTermsForKeyword(KeywordID keyword_id);
68 68
69 // Returns the underlying database associated with this backend. The current 69 // Returns the underlying database associated with this backend. The current
70 // autocomplete code was written fro this, but it should probably be removed 70 // autocomplete code was written fro this, but it should probably be removed
71 // so that it can deal directly with this object, rather than the DB. 71 // so that it can deal directly with this object, rather than the DB.
72 InMemoryDatabase* db() const { 72 InMemoryDatabase* db() const {
73 return db_.get(); 73 return db_.get();
74 } 74 }
75 75
76 // HistoryServiceObserver: 76 // HistoryServiceObserver:
77 virtual void OnURLVisited(HistoryService* history_service, 77 void OnURLVisited(HistoryService* history_service,
78 ui::PageTransition transition, 78 ui::PageTransition transition,
79 const URLRow& row, 79 const URLRow& row,
80 const RedirectList& redirects, 80 const RedirectList& redirects,
81 base::Time visit_time) override; 81 base::Time visit_time) override;
82 82
83 // Notification callback. 83 // Notification callback.
84 virtual void Observe(int type, 84 void Observe(int type,
85 const content::NotificationSource& source, 85 const content::NotificationSource& source,
86 const content::NotificationDetails& details) override; 86 const content::NotificationDetails& details) override;
87 87
88 private: 88 private:
89 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll); 89 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll);
90 90
91 // Handler for HISTORY_URL_VISITED and HISTORY_URLS_MODIFIED. 91 // Handler for HISTORY_URL_VISITED and HISTORY_URLS_MODIFIED.
92 void OnURLVisitedOrModified(const URLRow& url_row); 92 void OnURLVisitedOrModified(const URLRow& url_row);
93 93
94 // Handler for HISTORY_URLS_DELETED. 94 // Handler for HISTORY_URLS_DELETED.
95 void OnURLsDeleted(const URLsDeletedDetails& details); 95 void OnURLsDeleted(const URLsDeletedDetails& details);
96 96
(...skipping 11 matching lines...) Expand all
108 // initialization. 108 // initialization.
109 Profile* profile_; 109 Profile* profile_;
110 HistoryService* history_service_; 110 HistoryService* history_service_;
111 111
112 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); 112 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend);
113 }; 113 };
114 114
115 } // namespace history 115 } // namespace history
116 116
117 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ 117 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/history/in_memory_url_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698