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

Side by Side Diff: chrome/browser/extensions/api/declarative/rules_registry_service.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" 5 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // where the destruction of |*this| takes place. 115 // where the destruction of |*this| takes place.
116 // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed. 116 // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed.
117 rule_registries_.clear(); 117 rule_registries_.clear();
118 content::BrowserThread::PostTask( 118 content::BrowserThread::PostTask(
119 content::BrowserThread::IO, FROM_HERE, 119 content::BrowserThread::IO, FROM_HERE,
120 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, 120 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
121 profile_, WebViewKey(0, 0), 121 profile_, WebViewKey(0, 0),
122 scoped_refptr<WebRequestRulesRegistry>(NULL))); 122 scoped_refptr<WebRequestRulesRegistry>(NULL)));
123 } 123 }
124 124
125 static base::LazyInstance<ProfileKeyedAPIFactory<RulesRegistryService> > 125 static base::LazyInstance<BrowserContextKeyedAPIFactory<RulesRegistryService> >
126 g_factory = LAZY_INSTANCE_INITIALIZER; 126 g_factory = LAZY_INSTANCE_INITIALIZER;
127 127
128 // static 128 // static
129 ProfileKeyedAPIFactory<RulesRegistryService>* 129 BrowserContextKeyedAPIFactory<RulesRegistryService>*
130 RulesRegistryService::GetFactoryInstance() { 130 RulesRegistryService::GetFactoryInstance() {
131 return g_factory.Pointer(); 131 return g_factory.Pointer();
132 } 132 }
133 133
134 // static 134 // static
135 RulesRegistryService* RulesRegistryService::Get( 135 RulesRegistryService* RulesRegistryService::Get(
136 content::BrowserContext* context) { 136 content::BrowserContext* context) {
137 return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(context); 137 return BrowserContextKeyedAPIFactory<RulesRegistryService>::Get(context);
138 } 138 }
139 139
140 void RulesRegistryService::RegisterRulesRegistry( 140 void RulesRegistryService::RegisterRulesRegistry(
141 scoped_refptr<RulesRegistry> rule_registry) { 141 scoped_refptr<RulesRegistry> rule_registry) {
142 const std::string event_name(rule_registry->event_name()); 142 const std::string event_name(rule_registry->event_name());
143 RulesRegistryKey key(event_name, rule_registry->webview_key()); 143 RulesRegistryKey key(event_name, rule_registry->webview_key());
144 DCHECK(rule_registries_.find(key) == rule_registries_.end()); 144 DCHECK(rule_registries_.find(key) == rule_registries_.end());
145 rule_registries_[key] = rule_registry; 145 rule_registries_[key] = rule_registry;
146 } 146 }
147 147
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 RemoveWebViewRulesRegistries(process->GetID()); 238 RemoveWebViewRulesRegistries(process->GetID());
239 break; 239 break;
240 } 240 }
241 default: 241 default:
242 NOTREACHED(); 242 NOTREACHED();
243 break; 243 break;
244 } 244 }
245 } 245 }
246 246
247 } // namespace extensions 247 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698