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 #ifndef CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ |
6 #define CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
25 | 25 |
26 class Profile; | 26 class Profile; |
27 | 27 |
28 namespace history { | 28 namespace history { |
29 | 29 |
30 class ShortcutsDatabase; | 30 class ShortcutsDatabase; |
31 | 31 |
32 // This class manages the shortcut provider backend - access to database on the | 32 // This class manages the shortcut provider backend - access to database on the |
33 // db thread, etc. | 33 // db thread, etc. |
34 class ShortcutsBackend : public RefcountedProfileKeyedService, | 34 class ShortcutsBackend : public RefcountedBrowserContextKeyedService, |
35 public content::NotificationObserver { | 35 public content::NotificationObserver { |
36 public: | 36 public: |
37 // The following struct encapsulates one previously selected omnibox shortcut. | 37 // The following struct encapsulates one previously selected omnibox shortcut. |
38 struct Shortcut { | 38 struct Shortcut { |
39 Shortcut(const std::string& id, | 39 Shortcut(const std::string& id, |
40 const string16& text, | 40 const string16& text, |
41 const GURL& url, | 41 const GURL& url, |
42 const string16& contents, | 42 const string16& contents, |
43 const ACMatchClassifications& contents_class, | 43 const ACMatchClassifications& contents_class, |
44 const string16& description, | 44 const string16& description, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void InitInternal(); | 135 void InitInternal(); |
136 | 136 |
137 // Finishes initialization on UI thread, notifies all observers. | 137 // Finishes initialization on UI thread, notifies all observers. |
138 void InitCompleted(); | 138 void InitCompleted(); |
139 | 139 |
140 // content::NotificationObserver: | 140 // content::NotificationObserver: |
141 virtual void Observe(int type, | 141 virtual void Observe(int type, |
142 const content::NotificationSource& source, | 142 const content::NotificationSource& source, |
143 const content::NotificationDetails& details) OVERRIDE; | 143 const content::NotificationDetails& details) OVERRIDE; |
144 | 144 |
145 // RefcountedProfileKeyedService | 145 // RefcountedBrowserContextKeyedService |
146 virtual void ShutdownOnUIThread() OVERRIDE; | 146 virtual void ShutdownOnUIThread() OVERRIDE; |
147 | 147 |
148 enum CurrentState { | 148 enum CurrentState { |
149 NOT_INITIALIZED, // Backend created but not initialized. | 149 NOT_INITIALIZED, // Backend created but not initialized. |
150 INITIALIZING, // Init() called, but not completed yet. | 150 INITIALIZING, // Init() called, but not completed yet. |
151 INITIALIZED, // Initialization completed, all accessors can be safely | 151 INITIALIZED, // Initialization completed, all accessors can be safely |
152 // called. | 152 // called. |
153 }; | 153 }; |
154 | 154 |
155 CurrentState current_state_; | 155 CurrentState current_state_; |
(...skipping 14 matching lines...) Expand all Loading... |
170 | 170 |
171 // For some unit-test only. | 171 // For some unit-test only. |
172 bool no_db_access_; | 172 bool no_db_access_; |
173 | 173 |
174 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); | 174 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); |
175 }; | 175 }; |
176 | 176 |
177 } // namespace history | 177 } // namespace history |
178 | 178 |
179 #endif // CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ | 179 #endif // CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ |
OLD | NEW |