Chromium Code Reviews| Index: extensions/browser/api/runtime/runtime_api.cc |
| diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc |
| index 74222cd98f5c9714ab03b37ab5326c78460f9a33..4dfd3922f557c7b8c6920d23a9de2112ba6dbd39 100644 |
| --- a/extensions/browser/api/runtime/runtime_api.cc |
| +++ b/extensions/browser/api/runtime/runtime_api.cc |
| @@ -13,6 +13,8 @@ |
| #include "base/values.h" |
| #include "base/version.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| +#include "chrome/browser/extensions/extension_service.h" |
| +#include "chrome/browser/extensions/shared_module_service.h" |
|
elijahtaylor1
2014/06/05 22:36:45
these includes are triggering presubmit errors, ev
asargent_no_longer_on_chrome
2014/06/06 21:07:01
The goal is that nothing in src/extensions/ can de
elijahtaylor1
2014/06/06 21:20:42
I think I would prefer to do that short term (with
|
| #include "content/public/browser/browser_context.h" |
| #include "content/public/browser/child_process_security_policy.h" |
| #include "content/public/browser/notification_service.h" |
| @@ -32,6 +34,7 @@ |
| #include "extensions/common/error_utils.h" |
| #include "extensions/common/extension.h" |
| #include "extensions/common/manifest_handlers/background_info.h" |
| +#include "extensions/common/manifest_handlers/shared_module_info.h" |
| #include "url/gurl.h" |
| #include "webkit/browser/fileapi/isolated_context.h" |
| @@ -45,10 +48,12 @@ namespace { |
| const char kNoBackgroundPageError[] = "You do not have a background page."; |
| const char kPageLoadError[] = "Background page failed to load."; |
| +const char kInstallId[] = "id"; |
| const char kInstallReason[] = "reason"; |
| const char kInstallReasonChromeUpdate[] = "chrome_update"; |
| const char kInstallReasonUpdate[] = "update"; |
| const char kInstallReasonInstall[] = "install"; |
| +const char kInstallReasonSharedModuleUpdate[] = "shared_module_update"; |
| const char kInstallPreviousVersion[] = "previousVersion"; |
| const char kInvalidUrlError[] = "Invalid URL."; |
| const char kPlatformInfoUnavailable[] = "Platform information unavailable."; |
| @@ -334,6 +339,34 @@ void RuntimeEventRouter::DispatchOnInstalledEvent( |
| new Event(runtime::OnInstalled::kEventName, event_args.Pass())); |
| system->event_router()->DispatchEventWithLazyListener(extension_id, |
| event.Pass()); |
| + |
| + if (old_version.IsValid()) { |
| + const Extension* extension = |
| + ExtensionRegistry::Get(context)->enabled_extensions().GetByID( |
| + extension_id); |
| + if (SharedModuleInfo::IsSharedModule(extension)) { |
| + ExtensionService* service = system->extension_service(); |
| + DCHECK(service); |
| + SharedModuleService* sm_service = service->shared_module_service(); |
| + DCHECK(sm_service); |
| + scoped_ptr<const ExtensionSet> dependents = |
| + sm_service->GetDependentExtensions(extension); |
| + for (ExtensionSet::const_iterator i = dependents->begin(); |
| + i != dependents->end(); |
| + i++) { |
| + scoped_ptr<base::ListValue> sm_event_args(new base::ListValue()); |
| + base::DictionaryValue* sm_info = new base::DictionaryValue(); |
| + sm_event_args->Append(sm_info); |
| + sm_info->SetString(kInstallReason, kInstallReasonSharedModuleUpdate); |
| + sm_info->SetString(kInstallPreviousVersion, old_version.GetString()); |
| + sm_info->SetString(kInstallId, extension_id); |
| + scoped_ptr<Event> sm_event( |
| + new Event(runtime::OnInstalled::kEventName, sm_event_args.Pass())); |
| + system->event_router()->DispatchEventWithLazyListener((*i)->id(), |
| + sm_event.Pass()); |
| + } |
| + } |
| + } |
| } |
| // static |