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 "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
10 | 10 |
11 class Profile; | 11 namespace content { |
| 12 class BrowserContext; |
| 13 } |
12 | 14 |
13 namespace extensions { | 15 namespace extensions { |
14 | 16 |
15 // Manages and registers the gaia auth extension with the extension system. | 17 // Manages and registers the gaia auth extension with the extension system. |
16 class GaiaAuthExtensionLoader : public ProfileKeyedAPI { | 18 class GaiaAuthExtensionLoader : public ProfileKeyedAPI { |
17 public: | 19 public: |
18 explicit GaiaAuthExtensionLoader(Profile* profile); | 20 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); |
19 virtual ~GaiaAuthExtensionLoader(); | 21 virtual ~GaiaAuthExtensionLoader(); |
20 | 22 |
21 // 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. |
22 void LoadIfNeeded(); | 24 void LoadIfNeeded(); |
23 // Unload the gaia auth extension if no pending reference. | 25 // Unload the gaia auth extension if no pending reference. |
24 void UnloadIfNeeded(); | 26 void UnloadIfNeeded(); |
25 | 27 |
26 static GaiaAuthExtensionLoader* Get(Profile* profile); | 28 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context); |
27 | 29 |
28 // ProfileKeyedAPI implementation. | 30 // ProfileKeyedAPI implementation. |
29 static ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>* GetFactoryInstance(); | 31 static ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>* GetFactoryInstance(); |
30 | 32 |
31 private: | 33 private: |
32 friend class ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>; | 34 friend class ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>; |
33 | 35 |
34 // BrowserContextKeyedService overrides: | 36 // BrowserContextKeyedService overrides: |
35 virtual void Shutdown() OVERRIDE; | 37 virtual void Shutdown() OVERRIDE; |
36 | 38 |
37 // ProfileKeyedAPI implementation. | 39 // ProfileKeyedAPI implementation. |
38 static const char* service_name() { | 40 static const char* service_name() { |
39 return "GaiaAuthExtensionLoader"; | 41 return "GaiaAuthExtensionLoader"; |
40 } | 42 } |
41 static const bool kServiceRedirectedInIncognito = true; | 43 static const bool kServiceRedirectedInIncognito = true; |
42 | 44 |
43 Profile* profile_; | 45 content::BrowserContext* browser_context_; |
44 int load_count_; | 46 int load_count_; |
45 | 47 |
46 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); | 48 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); |
47 }; | 49 }; |
48 | 50 |
49 } // namespace extensions | 51 } // namespace extensions |
50 | 52 |
51 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ | 53 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ |
OLD | NEW |