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_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
12 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 #include "extensions/browser/browser_context_keyed_api_factory.h" | 15 #include "extensions/browser/browser_context_keyed_api_factory.h" |
16 #include "extensions/browser/event_router.h" | 16 #include "extensions/browser/event_router.h" |
17 | 17 |
18 class ExtensionService; | 18 class ExtensionService; |
19 class ExtensionUninstallDialog; | 19 class ExtensionUninstallDialog; |
20 | 20 |
21 namespace extensions { | 21 namespace extensions { |
22 | 22 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(ManagementEventRouter); | 190 DISALLOW_COPY_AND_ASSIGN(ManagementEventRouter); |
191 }; | 191 }; |
192 | 192 |
193 class ManagementAPI : public BrowserContextKeyedAPI, | 193 class ManagementAPI : public BrowserContextKeyedAPI, |
194 public extensions::EventRouter::Observer { | 194 public extensions::EventRouter::Observer { |
195 public: | 195 public: |
196 explicit ManagementAPI(content::BrowserContext* context); | 196 explicit ManagementAPI(content::BrowserContext* context); |
197 virtual ~ManagementAPI(); | 197 virtual ~ManagementAPI(); |
198 | 198 |
199 // BrowserContextKeyedService implementation. | 199 // KeyedService implementation. |
200 virtual void Shutdown() OVERRIDE; | 200 virtual void Shutdown() OVERRIDE; |
201 | 201 |
202 // BrowserContextKeyedAPI implementation. | 202 // BrowserContextKeyedAPI implementation. |
203 static BrowserContextKeyedAPIFactory<ManagementAPI>* GetFactoryInstance(); | 203 static BrowserContextKeyedAPIFactory<ManagementAPI>* GetFactoryInstance(); |
204 | 204 |
205 // EventRouter::Observer implementation. | 205 // EventRouter::Observer implementation. |
206 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) | 206 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) |
207 OVERRIDE; | 207 OVERRIDE; |
208 | 208 |
209 private: | 209 private: |
210 friend class BrowserContextKeyedAPIFactory<ManagementAPI>; | 210 friend class BrowserContextKeyedAPIFactory<ManagementAPI>; |
211 | 211 |
212 content::BrowserContext* browser_context_; | 212 content::BrowserContext* browser_context_; |
213 | 213 |
214 // BrowserContextKeyedAPI implementation. | 214 // BrowserContextKeyedAPI implementation. |
215 static const char* service_name() { | 215 static const char* service_name() { |
216 return "ManagementAPI"; | 216 return "ManagementAPI"; |
217 } | 217 } |
218 static const bool kServiceIsNULLWhileTesting = true; | 218 static const bool kServiceIsNULLWhileTesting = true; |
219 | 219 |
220 // Created lazily upon OnListenerAdded. | 220 // Created lazily upon OnListenerAdded. |
221 scoped_ptr<ManagementEventRouter> management_event_router_; | 221 scoped_ptr<ManagementEventRouter> management_event_router_; |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); | 223 DISALLOW_COPY_AND_ASSIGN(ManagementAPI); |
224 }; | 224 }; |
225 | 225 |
226 } // namespace extensions | 226 } // namespace extensions |
227 | 227 |
228 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ | 228 #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_ |
OLD | NEW |