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/api/profile_keyed_api_factory.h" | 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 content::NotificationRegistrar registrar_; | 186 content::NotificationRegistrar registrar_; |
187 | 187 |
188 Profile* profile_; | 188 Profile* profile_; |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(ManagementEventRouter); | 190 DISALLOW_COPY_AND_ASSIGN(ManagementEventRouter); |
191 }; | 191 }; |
192 | 192 |
193 class ManagementAPI : public ProfileKeyedAPI, | 193 class ManagementAPI : public ProfileKeyedAPI, |
194 public extensions::EventRouter::Observer { | 194 public extensions::EventRouter::Observer { |
195 public: | 195 public: |
196 explicit ManagementAPI(Profile* profile); | 196 explicit ManagementAPI(content::BrowserContext* context); |
197 virtual ~ManagementAPI(); | 197 virtual ~ManagementAPI(); |
198 | 198 |
199 // BrowserContextKeyedService implementation. | 199 // BrowserContextKeyedService implementation. |
200 virtual void Shutdown() OVERRIDE; | 200 virtual void Shutdown() OVERRIDE; |
201 | 201 |
202 // ProfileKeyedAPI implementation. | 202 // ProfileKeyedAPI implementation. |
203 static ProfileKeyedAPIFactory<ManagementAPI>* GetFactoryInstance(); | 203 static ProfileKeyedAPIFactory<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 ProfileKeyedAPIFactory<ManagementAPI>; | 210 friend class ProfileKeyedAPIFactory<ManagementAPI>; |
211 | 211 |
212 Profile* profile_; | 212 content::BrowserContext* browser_context_; |
213 | 213 |
214 // ProfileKeyedAPI implementation. | 214 // ProfileKeyedAPI 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 |