| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 9 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 class BrowserContext; | 12 class BrowserContext; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // Manages and registers the gaia auth extension with the extension system. | 17 // Manages and registers the gaia auth extension with the extension system. |
| 18 class GaiaAuthExtensionLoader : public ProfileKeyedAPI { | 18 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI { |
| 19 public: | 19 public: |
| 20 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); | 20 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); |
| 21 virtual ~GaiaAuthExtensionLoader(); | 21 virtual ~GaiaAuthExtensionLoader(); |
| 22 | 22 |
| 23 // Load the gaia auth extension if the extension is not loaded yet. | 23 // Load the gaia auth extension if the extension is not loaded yet. |
| 24 void LoadIfNeeded(); | 24 void LoadIfNeeded(); |
| 25 // Unload the gaia auth extension if no pending reference. | 25 // Unload the gaia auth extension if no pending reference. |
| 26 void UnloadIfNeeded(); | 26 void UnloadIfNeeded(); |
| 27 | 27 |
| 28 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context); | 28 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context); |
| 29 | 29 |
| 30 // ProfileKeyedAPI implementation. | 30 // BrowserContextKeyedAPI implementation. |
| 31 static ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>* GetFactoryInstance(); | 31 static BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* |
| 32 GetFactoryInstance(); |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 friend class ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>; | 35 friend class BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>; |
| 35 | 36 |
| 36 // BrowserContextKeyedService overrides: | 37 // BrowserContextKeyedService overrides: |
| 37 virtual void Shutdown() OVERRIDE; | 38 virtual void Shutdown() OVERRIDE; |
| 38 | 39 |
| 39 // ProfileKeyedAPI implementation. | 40 // BrowserContextKeyedAPI implementation. |
| 40 static const char* service_name() { | 41 static const char* service_name() { |
| 41 return "GaiaAuthExtensionLoader"; | 42 return "GaiaAuthExtensionLoader"; |
| 42 } | 43 } |
| 43 static const bool kServiceRedirectedInIncognito = true; | 44 static const bool kServiceRedirectedInIncognito = true; |
| 44 | 45 |
| 45 content::BrowserContext* browser_context_; | 46 content::BrowserContext* browser_context_; |
| 46 int load_count_; | 47 int load_count_; |
| 47 | 48 |
| 48 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); | 49 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 } // namespace extensions | 52 } // namespace extensions |
| 52 | 53 |
| 53 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ | 54 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ |
| OLD | NEW |