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

Unified Diff: components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc

Issue 196783002: Export a private webstore API to call into the new inline sign-in flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove a spurious diff Created 6 years, 8 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/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc
index 4f75d99a72e6dbbb1504f04d7e0c9622f5a6b01e..6876ce5c5f0e31a9a8b7251150b86b89cf37db1d 100644
--- a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc
+++ b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc
@@ -13,6 +13,11 @@
void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory(
content::BrowserContext* context,
TestingFactoryFunction testing_factory) {
+ if (!context) {
+ testing_factories_[NULL] = testing_factory;
+ return;
+ }
+
// Destroying the context may cause us to lose data about whether |context|
// has our preferences registered on it (since the context object itself
// isn't dead). See if we need to readd it once we've gone through normal
@@ -71,10 +76,12 @@ RefcountedBrowserContextKeyedServiceFactory::GetServiceForBrowserContext(
// Create new object.
// Check to see if we have a per-BrowserContext testing factory that we should
- // use instead of default behavior.
+ // use instead of default behavior. Check for a global factory as well.
scoped_refptr<RefcountedBrowserContextKeyedService> service;
BrowserContextOverriddenTestingFunctions::const_iterator jt =
testing_factories_.find(context);
+ if (jt == testing_factories_.end())
+ jt = testing_factories_.find(NULL);
if (jt != testing_factories_.end()) {
if (jt->second) {
if (!context->IsOffTheRecord())

Powered by Google App Engine
This is Rietveld 408576698