| 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 28 matching lines...) Expand all Loading... |
| 39 return webview_key.embedder_process_id && webview_key.webview_instance_id; | 39 return webview_key.embedder_process_id && webview_key.webview_instance_id; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 RulesRegistryService::RulesRegistryService(content::BrowserContext* context) | 44 RulesRegistryService::RulesRegistryService(content::BrowserContext* context) |
| 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, | 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, |
| 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()); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 base::Bind(notification_callback, registry, extension_id)); | 204 base::Bind(notification_callback, registry, extension_id)); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void RulesRegistryService::Observe( | 209 void RulesRegistryService::Observe( |
| 210 int type, | 210 int type, |
| 211 const content::NotificationSource& source, | 211 const content::NotificationSource& source, |
| 212 const content::NotificationDetails& details) { | 212 const content::NotificationDetails& details) { |
| 213 switch (type) { | 213 switch (type) { |
| 214 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 214 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 215 const Extension* extension = | 215 const Extension* extension = |
| 216 content::Details<UnloadedExtensionInfo>(details)->extension; | 216 content::Details<UnloadedExtensionInfo>(details)->extension; |
| 217 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUnloaded, | 217 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUnloaded, |
| 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, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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 |