| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 : content_rules_registry_(NULL), | 45 : content_rules_registry_(NULL), |
| 46 profile_(Profile::FromBrowserContext(context)) { | 46 profile_(Profile::FromBrowserContext(context)) { |
| 47 if (profile_) { | 47 if (profile_) { |
| 48 registrar_.Add(this, | 48 registrar_.Add(this, |
| 49 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 49 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 50 content::Source<Profile>(profile_->GetOriginalProfile())); | 50 content::Source<Profile>(profile_->GetOriginalProfile())); |
| 51 registrar_.Add(this, | 51 registrar_.Add(this, |
| 52 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 52 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 53 content::Source<Profile>(profile_->GetOriginalProfile())); | 53 content::Source<Profile>(profile_->GetOriginalProfile())); |
| 54 registrar_.Add(this, | 54 registrar_.Add(this, |
| 55 chrome::NOTIFICATION_EXTENSION_LOADED, | 55 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 56 content::Source<Profile>(profile_->GetOriginalProfile())); | 56 content::Source<Profile>(profile_->GetOriginalProfile())); |
| 57 registrar_.Add( | 57 registrar_.Add( |
| 58 this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 58 this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 59 content::NotificationService::AllBrowserContextsAndSources()); | 59 content::NotificationService::AllBrowserContextsAndSources()); |
| 60 EnsureDefaultRulesRegistriesRegistered(WebViewKey(0, 0)); | 60 EnsureDefaultRulesRegistriesRegistered(WebViewKey(0, 0)); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 RulesRegistryService::~RulesRegistryService() {} | 64 RulesRegistryService::~RulesRegistryService() {} |
| 65 | 65 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 extension->id()); | 218 extension->id()); |
| 219 break; | 219 break; |
| 220 } | 220 } |
| 221 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { | 221 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
| 222 const Extension* extension = | 222 const Extension* extension = |
| 223 content::Details<const Extension>(details).ptr(); | 223 content::Details<const Extension>(details).ptr(); |
| 224 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled, | 224 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled, |
| 225 extension->id()); | 225 extension->id()); |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 228 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 229 const Extension* extension = | 229 const Extension* extension = |
| 230 content::Details<const Extension>(details).ptr(); | 230 content::Details<const Extension>(details).ptr(); |
| 231 NotifyRegistriesHelper(&RulesRegistry::OnExtensionLoaded, | 231 NotifyRegistriesHelper(&RulesRegistry::OnExtensionLoaded, |
| 232 extension->id()); | 232 extension->id()); |
| 233 break; | 233 break; |
| 234 } | 234 } |
| 235 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { | 235 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { |
| 236 content::RenderProcessHost* process = | 236 content::RenderProcessHost* process = |
| 237 content::Source<content::RenderProcessHost>(source).ptr(); | 237 content::Source<content::RenderProcessHost>(source).ptr(); |
| 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 |
| OLD | NEW |