| Index: chrome/browser/extensions/extensions_service.cc
|
| diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
|
| index f97ea92ecc458d841c79c76bca8d13126dd2156b..25bace0ac47d82c57a9c3d94b2c19855dd122511 100644
|
| --- a/chrome/browser/extensions/extensions_service.cc
|
| +++ b/chrome/browser/extensions/extensions_service.cc
|
| @@ -150,6 +150,15 @@ PendingExtensionInfo::PendingExtensionInfo()
|
| enable_incognito_on_install(false),
|
| install_source(Extension::INVALID) {}
|
|
|
| +
|
| +ExtensionsService::ExtensionRuntimeData::ExtensionRuntimeData()
|
| + : background_page_ready(false),
|
| + being_upgraded(false) {
|
| +}
|
| +
|
| +ExtensionsService::ExtensionRuntimeData::~ExtensionRuntimeData() {
|
| +}
|
| +
|
| // ExtensionsService.
|
|
|
| const char* ExtensionsService::kInstallDirectoryName = "Extensions";
|
| @@ -1327,6 +1336,9 @@ void ExtensionsService::UnloadExtension(const std::string& extension_id) {
|
| // Clean up if the extension is meant to be enabled after a reload.
|
| disabled_extension_paths_.erase(extension->id());
|
|
|
| + // Clean up runtime data.
|
| + extension_runtime_data_.erase(extension_id);
|
| +
|
| ExtensionDOMUI::UnregisterChromeURLOverrides(profile_,
|
| extension->GetChromeURLOverrides());
|
|
|
| @@ -1354,6 +1366,7 @@ void ExtensionsService::UnloadExtension(const std::string& extension_id) {
|
| void ExtensionsService::UnloadAllExtensions() {
|
| extensions_.clear();
|
| disabled_extensions_.clear();
|
| + extension_runtime_data_.clear();
|
|
|
| // TODO(erikkay) should there be a notification for this? We can't use
|
| // EXTENSION_UNLOADED since that implies that the extension has been disabled
|
| @@ -1426,8 +1439,8 @@ void ExtensionsService::OnExtensionLoaded(const Extension* extension,
|
| // Extensions get upgraded if silent upgrades are allowed, otherwise
|
| // they get disabled.
|
| if (allow_silent_upgrade) {
|
| - old->set_being_upgraded(true);
|
| - extension->set_being_upgraded(true);
|
| + SetBeingUpgraded(old, true);
|
| + SetBeingUpgraded(extension, true);
|
| }
|
|
|
| // To upgrade an extension in place, unload the old one and
|
| @@ -1465,7 +1478,7 @@ void ExtensionsService::OnExtensionLoaded(const Extension* extension,
|
| }
|
| }
|
|
|
| - extension->set_being_upgraded(false);
|
| + SetBeingUpgraded(extension, false);
|
|
|
| UpdateActiveExtensionsInCrashReporter();
|
|
|
| @@ -1841,3 +1854,26 @@ ExtensionIdSet ExtensionsService::GetAppIds() const {
|
|
|
| return result;
|
| }
|
| +
|
| +bool ExtensionsService::IsBackgroundPageReady(const Extension* extension) {
|
| + return (extension->background_url().is_empty() ||
|
| + extension_runtime_data_[extension->id()].background_page_ready);
|
| +}
|
| +
|
| +void ExtensionsService::SetBackgroundPageReady(const Extension* extension) {
|
| + DCHECK(!extension->background_url().is_empty());
|
| + extension_runtime_data_[extension->id()].background_page_ready = true;
|
| + NotificationService::current()->Notify(
|
| + NotificationType::EXTENSION_BACKGROUND_PAGE_READY,
|
| + Source<const Extension>(extension),
|
| + NotificationService::NoDetails());
|
| +}
|
| +
|
| +bool ExtensionsService::IsBeingUpgraded(const Extension* extension) {
|
| + return extension_runtime_data_[extension->id()].being_upgraded;
|
| +}
|
| +
|
| +void ExtensionsService::SetBeingUpgraded(const Extension* extension,
|
| + bool value) {
|
| + extension_runtime_data_[extension->id()].being_upgraded = value;
|
| +}
|
|
|