Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/extensions/signin/gaia_auth_extension_loader.h

Issue 902493003: cros: Pass gaia_auth init params via postMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/signin/gaia_auth_extension_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map>
9 #include <string>
10
11 #include "base/macros.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h" 12 #include "extensions/browser/browser_context_keyed_api_factory.h"
10 13
11 namespace content { 14 namespace content {
12 class BrowserContext; 15 class BrowserContext;
13 } 16 }
14 17
15 namespace extensions { 18 namespace extensions {
16 19
17 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik"; 20 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik";
18 const char kGaiaAuthExtensionOrigin[] = 21 const char kGaiaAuthExtensionOrigin[] =
19 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik"; 22 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik";
20 23
21 // Manages and registers the gaia auth extension with the extension system. 24 // Manages and registers the gaia auth extension with the extension system.
22 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI { 25 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI {
23 public: 26 public:
24 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); 27 explicit GaiaAuthExtensionLoader(content::BrowserContext* context);
25 ~GaiaAuthExtensionLoader() override; 28 ~GaiaAuthExtensionLoader() override;
26 29
27 // Load the gaia auth extension if the extension is not loaded yet. 30 // Load the gaia auth extension if the extension is not loaded yet.
28 void LoadIfNeeded(); 31 void LoadIfNeeded();
29 // Unload the gaia auth extension if no pending reference. 32 // Unload the gaia auth extension if no pending reference.
30 void UnloadIfNeeded(); 33 void UnloadIfNeeded();
31 34
35 // Add a string data for gaia auth extension. Returns an ID that
36 // could be used to get the data. All strings are cleared when gaia auth
37 // is unloaded.
38 int AddData(const std::string& data);
39
40 // Get data for the given ID. Returns true if the data is found and
41 // its value is copied to |data|. Otherwise, returns false.
42 bool GetData(int data_id, std::string* data);
43
32 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context); 44 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context);
33 45
34 // BrowserContextKeyedAPI implementation. 46 // BrowserContextKeyedAPI implementation.
35 static BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* 47 static BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>*
36 GetFactoryInstance(); 48 GetFactoryInstance();
37 49
38 private: 50 private:
39 friend class BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>; 51 friend class BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>;
40 52
41 // KeyedService overrides: 53 // KeyedService overrides:
42 void Shutdown() override; 54 void Shutdown() override;
43 55
44 // BrowserContextKeyedAPI implementation. 56 // BrowserContextKeyedAPI implementation.
45 static const char* service_name() { 57 static const char* service_name() {
46 return "GaiaAuthExtensionLoader"; 58 return "GaiaAuthExtensionLoader";
47 } 59 }
48 static const bool kServiceRedirectedInIncognito = true; 60 static const bool kServiceRedirectedInIncognito = true;
49 61
50 content::BrowserContext* browser_context_; 62 content::BrowserContext* browser_context_;
51 int load_count_; 63 int load_count_;
52 64
65 int last_data_id_;
66 std::map<int, std::string> data_;
67
53 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); 68 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader);
54 }; 69 };
55 70
56 } // namespace extensions 71 } // namespace extensions
57 72
58 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ 73 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/signin/gaia_auth_extension_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698