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 "extensions/browser/browser_context_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 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik"; | 17 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik"; |
18 const char kGaiaAuthExtensionOrigin[] = | 18 const char kGaiaAuthExtensionOrigin[] = |
19 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik"; | 19 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik"; |
20 | 20 |
21 // Manages and registers the gaia auth extension with the extension system. | 21 // Manages and registers the gaia auth extension with the extension system. |
22 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI { | 22 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI { |
23 public: | 23 public: |
24 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); | 24 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); |
25 virtual ~GaiaAuthExtensionLoader(); | 25 ~GaiaAuthExtensionLoader() override; |
26 | 26 |
27 // Load the gaia auth extension if the extension is not loaded yet. | 27 // Load the gaia auth extension if the extension is not loaded yet. |
28 void LoadIfNeeded(); | 28 void LoadIfNeeded(); |
29 // Unload the gaia auth extension if no pending reference. | 29 // Unload the gaia auth extension if no pending reference. |
30 void UnloadIfNeeded(); | 30 void UnloadIfNeeded(); |
31 | 31 |
32 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context); | 32 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context); |
33 | 33 |
34 // BrowserContextKeyedAPI implementation. | 34 // BrowserContextKeyedAPI implementation. |
35 static BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* | 35 static BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* |
36 GetFactoryInstance(); | 36 GetFactoryInstance(); |
37 | 37 |
38 private: | 38 private: |
39 friend class BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>; | 39 friend class BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>; |
40 | 40 |
41 // KeyedService overrides: | 41 // KeyedService overrides: |
42 virtual void Shutdown() override; | 42 void Shutdown() override; |
43 | 43 |
44 // BrowserContextKeyedAPI implementation. | 44 // BrowserContextKeyedAPI implementation. |
45 static const char* service_name() { | 45 static const char* service_name() { |
46 return "GaiaAuthExtensionLoader"; | 46 return "GaiaAuthExtensionLoader"; |
47 } | 47 } |
48 static const bool kServiceRedirectedInIncognito = true; | 48 static const bool kServiceRedirectedInIncognito = true; |
49 | 49 |
50 content::BrowserContext* browser_context_; | 50 content::BrowserContext* browser_context_; |
51 int load_count_; | 51 int load_count_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); | 53 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace extensions | 56 } // namespace extensions |
57 | 57 |
58 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ | 58 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ |
OLD | NEW |