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

Unified Diff: components/browser_context_keyed_service/browser_context_keyed_service_factory.h

Issue 23068005: Convert UserPolicySigninService to use OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android fixes. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/browser_context_keyed_service/browser_context_keyed_service_factory.h
diff --git a/components/browser_context_keyed_service/browser_context_keyed_service_factory.h b/components/browser_context_keyed_service/browser_context_keyed_service_factory.h
index 2775e4cc45b28e44510b75f983613d7c88952a29..8142d9cb161feb1cb792f88c53688b4b104e2279 100644
--- a/components/browser_context_keyed_service/browser_context_keyed_service_factory.h
+++ b/components/browser_context_keyed_service/browser_context_keyed_service_factory.h
@@ -39,6 +39,15 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextKeyedServiceFactory
void SetTestingFactory(content::BrowserContext* context,
FactoryFunction factory);
+ // Like SetTestingFactory(), but takes effect for all contexts. This is useful
+ // for injecting services that are created as part of context initialization.
+ // Callers should be sure to call ResetGlobalTestingFactory() at the end of
+ // their test to avoid polluting the singletons for future tests.
+ void SetGlobalTestingFactory(FactoryFunction factory);
Elliot Glaysher 2013/08/16 18:07:59 (Other half of code commented on.)
Andrew T Wilson (Slow) 2013/08/19 12:15:56 So, yeah, I'm happy to revert this part of my CL (
+
+ // Clears a global testing factory that was previously set.
+ void ResetGlobalTestingFactory();
+
// Associates |factory| with |context| and immediately returns the created
// BrowserContextKeyedService. Since the factory will be used immediately,
// it may not be NULL.
@@ -110,12 +119,17 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextKeyedServiceFactory
typedef std::map<content::BrowserContext*, FactoryFunction>
BrowserContextOverriddenFunctions;
+ void CleanupExistingServices(content::BrowserContext* context);
+
// The mapping between a BrowserContext and its service.
std::map<content::BrowserContext*, BrowserContextKeyedService*> mapping_;
// The mapping between a BrowserContext and its overridden FactoryFunction.
std::map<content::BrowserContext*, FactoryFunction> factories_;
+ FactoryFunction global_factory_;
+ bool have_global_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory);
};

Powered by Google App Engine
This is Rietveld 408576698