| 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);
|
| +
|
| + // 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);
|
| };
|
|
|
|
|