OLD | NEW |
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled, extension_id); | 181 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled, extension_id); |
182 } | 182 } |
183 | 183 |
184 void RulesRegistryService::NotifyRegistriesHelper( | 184 void RulesRegistryService::NotifyRegistriesHelper( |
185 void (RulesRegistry::*notification_callback)(const std::string&), | 185 void (RulesRegistry::*notification_callback)(const std::string&), |
186 const std::string& extension_id) { | 186 const std::string& extension_id) { |
187 RulesRegistryMap::iterator i; | 187 RulesRegistryMap::iterator i; |
188 for (i = rule_registries_.begin(); i != rule_registries_.end(); ++i) { | 188 for (i = rule_registries_.begin(); i != rule_registries_.end(); ++i) { |
189 scoped_refptr<RulesRegistry> registry = i->second; | 189 scoped_refptr<RulesRegistry> registry = i->second; |
190 if (content::BrowserThread::CurrentlyOn(registry->owner_thread())) { | 190 if (content::BrowserThread::CurrentlyOn(registry->owner_thread())) { |
191 (registry->*notification_callback)(extension_id); | 191 (registry.get()->*notification_callback)(extension_id); |
192 } else { | 192 } else { |
193 content::BrowserThread::PostTask( | 193 content::BrowserThread::PostTask( |
194 registry->owner_thread(), | 194 registry->owner_thread(), |
195 FROM_HERE, | 195 FROM_HERE, |
196 base::Bind(notification_callback, registry, extension_id)); | 196 base::Bind(notification_callback, registry, extension_id)); |
197 } | 197 } |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 void RulesRegistryService::OnExtensionLoaded( | 201 void RulesRegistryService::OnExtensionLoaded( |
(...skipping 22 matching lines...) Expand all Loading... |
224 const content::NotificationSource& source, | 224 const content::NotificationSource& source, |
225 const content::NotificationDetails& details) { | 225 const content::NotificationDetails& details) { |
226 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type); | 226 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type); |
227 | 227 |
228 content::RenderProcessHost* process = | 228 content::RenderProcessHost* process = |
229 content::Source<content::RenderProcessHost>(source).ptr(); | 229 content::Source<content::RenderProcessHost>(source).ptr(); |
230 RemoveWebViewRulesRegistries(process->GetID()); | 230 RemoveWebViewRulesRegistries(process->GetID()); |
231 } | 231 } |
232 | 232 |
233 } // namespace extensions | 233 } // namespace extensions |
OLD | NEW |