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

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

Issue 961443003: Unload the ScopedGaiaAuthExtension asynchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix whitespace Created 5 years, 9 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
12 #include "extensions/browser/browser_context_keyed_api_factory.h" 13 #include "extensions/browser/browser_context_keyed_api_factory.h"
13 14
14 namespace content { 15 namespace content {
15 class BrowserContext; 16 class BrowserContext;
16 } 17 }
17 18
18 namespace extensions { 19 namespace extensions {
19 20
20 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik"; 21 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik";
21 const char kGaiaAuthExtensionOrigin[] = 22 const char kGaiaAuthExtensionOrigin[] =
22 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik"; 23 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik";
23 24
24 // Manages and registers the gaia auth extension with the extension system. 25 // Manages and registers the gaia auth extension with the extension system.
25 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI { 26 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI {
26 public: 27 public:
27 explicit GaiaAuthExtensionLoader(content::BrowserContext* context); 28 explicit GaiaAuthExtensionLoader(content::BrowserContext* context);
28 ~GaiaAuthExtensionLoader() override; 29 ~GaiaAuthExtensionLoader() override;
29 30
30 // Load the gaia auth extension if the extension is not loaded yet. 31 // Load the gaia auth extension if the extension is not loaded yet.
31 void LoadIfNeeded(); 32 void LoadIfNeeded();
32 // Unload the gaia auth extension if no pending reference. 33 // Unload the gaia auth extension if no pending reference.
33 void UnloadIfNeeded(); 34 void UnloadIfNeeded();
35 void UnloadIfNeededAsync();
34 36
35 // Add a string data for gaia auth extension. Returns an ID that 37 // 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 38 // could be used to get the data. All strings are cleared when gaia auth
37 // is unloaded. 39 // is unloaded.
38 int AddData(const std::string& data); 40 int AddData(const std::string& data);
39 41
40 // Get data for the given ID. Returns true if the data is found and 42 // Get data for the given ID. Returns true if the data is found and
41 // its value is copied to |data|. Otherwise, returns false. 43 // its value is copied to |data|. Otherwise, returns false.
42 bool GetData(int data_id, std::string* data); 44 bool GetData(int data_id, std::string* data);
43 45
(...skipping 14 matching lines...) Expand all
58 return "GaiaAuthExtensionLoader"; 60 return "GaiaAuthExtensionLoader";
59 } 61 }
60 static const bool kServiceRedirectedInIncognito = true; 62 static const bool kServiceRedirectedInIncognito = true;
61 63
62 content::BrowserContext* browser_context_; 64 content::BrowserContext* browser_context_;
63 int load_count_; 65 int load_count_;
64 66
65 int last_data_id_; 67 int last_data_id_;
66 std::map<int, std::string> data_; 68 std::map<int, std::string> data_;
67 69
70 base::WeakPtrFactory<GaiaAuthExtensionLoader> weak_ptr_factory_;
71
68 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader); 72 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader);
69 }; 73 };
70 74
71 } // namespace extensions 75 } // namespace extensions
72 76
73 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_ 77 #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