| Index: chrome/browser/extensions/extension_service.cc
|
| diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
|
| index 84397982cc4e10874b4d7d1a24dfd29d71d0adef..7a0b1b6d587714b07eeb98cd86df66fcc52c118d 100644
|
| --- a/chrome/browser/extensions/extension_service.cc
|
| +++ b/chrome/browser/extensions/extension_service.cc
|
| @@ -400,8 +400,6 @@ ExtensionService::ExtensionService(Profile* profile,
|
| extensions_enabled_ = false;
|
| }
|
|
|
| - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
|
| - content::NotificationService::AllBrowserContextsAndSources());
|
| registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
|
| content::NotificationService::AllBrowserContextsAndSources());
|
| registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
|
| @@ -459,15 +457,10 @@ const ExtensionSet* ExtensionService::disabled_extensions() const {
|
| return &disabled_extensions_;
|
| }
|
|
|
| -const ExtensionSet* ExtensionService::terminated_extensions() const {
|
| - return &terminated_extensions_;
|
| -}
|
| -
|
| const ExtensionSet* ExtensionService::GenerateInstalledExtensionsSet() const {
|
| ExtensionSet* installed_extensions = new ExtensionSet();
|
| installed_extensions->InsertAll(extensions_);
|
| installed_extensions->InsertAll(disabled_extensions_);
|
| - installed_extensions->InsertAll(terminated_extensions_);
|
| return installed_extensions;
|
| }
|
|
|
| @@ -564,7 +557,7 @@ void ExtensionService::InitEventRouters() {
|
|
|
| const Extension* ExtensionService::GetExtensionById(
|
| const std::string& id, bool include_disabled) const {
|
| - return GetExtensionByIdInternal(id, true, include_disabled, false);
|
| + return GetExtensionByIdInternal(id, true, include_disabled);
|
| }
|
|
|
| void ExtensionService::Init() {
|
| @@ -608,8 +601,7 @@ bool ExtensionService::UpdateExtension(
|
| bool is_pending_extension = pending_extension_manager_.GetById(
|
| id, &pending_extension_info);
|
|
|
| - const Extension* extension =
|
| - GetExtensionByIdInternal(id, true, true, false);
|
| + const Extension* extension = GetExtensionByIdInternal(id, true, true);
|
| if (!is_pending_extension && !extension) {
|
| LOG(WARNING) << "Will not update extension " << id
|
| << " because it is not installed or pending";
|
| @@ -818,8 +810,6 @@ bool ExtensionService::UninstallExtension(
|
| ExtensionDataDeleter::StartDeleting(
|
| profile_, extension_id, extension->url(), is_storage_isolated);
|
|
|
| - UntrackTerminatedExtension(extension_id);
|
| -
|
| // Notify interested parties that we've uninstalled this extension.
|
| content::NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
|
| @@ -855,8 +845,7 @@ bool ExtensionService::UninstallExtension(
|
|
|
| bool ExtensionService::IsExtensionEnabled(
|
| const std::string& extension_id) const {
|
| - if (extensions_.Contains(extension_id) ||
|
| - terminated_extensions_.Contains(extension_id))
|
| + if (extensions_.Contains(extension_id))
|
| return true;
|
|
|
| if (disabled_extensions_.Contains(extension_id))
|
| @@ -882,7 +871,7 @@ void ExtensionService::EnableExtension(const std::string& extension_id) {
|
| extension_prefs_->SetExtensionState(extension_id, Extension::ENABLED);
|
|
|
| const Extension* extension =
|
| - GetExtensionByIdInternal(extension_id, false, true, false);
|
| + GetExtensionByIdInternal(extension_id, false, true);
|
| // This can happen if sync enables an extension that is not
|
| // installed yet.
|
| if (!extension)
|
| @@ -915,7 +904,7 @@ void ExtensionService::DisableExtension(const std::string& extension_id) {
|
|
|
| extension_prefs_->SetExtensionState(extension_id, Extension::DISABLED);
|
|
|
| - extension = GetExtensionByIdInternal(extension_id, true, false, true);
|
| + extension = GetExtensionByIdInternal(extension_id, true, false);
|
| if (!extension)
|
| return;
|
|
|
| @@ -923,8 +912,6 @@ void ExtensionService::DisableExtension(const std::string& extension_id) {
|
| disabled_extensions_.Insert(make_scoped_refptr(extension));
|
| if (extensions_.Contains(extension->id()))
|
| extensions_.Remove(extension->id());
|
| - else
|
| - terminated_extensions_.Remove(extension->id());
|
|
|
| NotifyExtensionUnloaded(extension, extension_misc::UNLOAD_REASON_DISABLE);
|
|
|
| @@ -1467,7 +1454,6 @@ std::vector<ExtensionSyncData> ExtensionService::GetSyncDataList(
|
| std::vector<ExtensionSyncData> extension_sync_list;
|
| GetSyncDataListHelper(extensions_, bundle, &extension_sync_list);
|
| GetSyncDataListHelper(disabled_extensions_, bundle, &extension_sync_list);
|
| - GetSyncDataListHelper(terminated_extensions_, bundle, &extension_sync_list);
|
|
|
| for (std::map<std::string, ExtensionSyncData>::const_iterator i =
|
| bundle.pending_sync_data.begin();
|
| @@ -1906,7 +1892,7 @@ void ExtensionService::UnloadExtension(
|
| extension_misc::UnloadedExtensionReason reason) {
|
| // Make sure the extension gets deleted after we return from this function.
|
| scoped_refptr<const Extension> extension(
|
| - GetExtensionByIdInternal(extension_id, true, true, false));
|
| + GetExtensionByIdInternal(extension_id, true, true));
|
|
|
| // This method can be called via PostTask, so the extension may have been
|
| // unloaded by the time this runs.
|
| @@ -1954,7 +1940,6 @@ void ExtensionService::UnloadAllExtensions() {
|
|
|
| extensions_.Clear();
|
| disabled_extensions_.Clear();
|
| - terminated_extensions_.Clear();
|
| extension_runtime_data_.clear();
|
|
|
| // TODO(erikkay) should there be a notification for this? We can't use
|
| @@ -2025,9 +2010,6 @@ void ExtensionService::AddExtension(const Extension* extension) {
|
| // The extension is now loaded, remove its data from unloaded extension map.
|
| unloaded_extension_paths_.erase(extension->id());
|
|
|
| - // If a terminated extension is loaded, remove it from the terminated list.
|
| - UntrackTerminatedExtension(extension->id());
|
| -
|
| // If the extension was disabled for a reload, then enable it.
|
| if (disabled_extension_paths_.erase(extension->id()) > 0)
|
| EnableExtension(extension->id());
|
| @@ -2106,8 +2088,7 @@ void ExtensionService::InitializePermissions(const Extension* extension) {
|
| // still remember that "omnibox" had been granted, so that if the
|
| // extension once again includes "omnibox" in an upgrade, the extension
|
| // can upgrade without requiring this user's approval.
|
| - const Extension* old = GetExtensionByIdInternal(extension->id(),
|
| - true, true, false);
|
| + const Extension* old = GetExtensionByIdInternal(extension->id(), true, true);
|
| bool is_extension_upgrade = old != NULL;
|
| bool is_privilege_increase = false;
|
|
|
| @@ -2221,7 +2202,7 @@ void ExtensionService::OnExtensionInstalled(
|
| }
|
|
|
| // Do not record the install histograms for upgrades.
|
| - if (!GetExtensionByIdInternal(extension->id(), true, true, false)) {
|
| + if (!GetExtensionByIdInternal(extension->id(), true, true)) {
|
| UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType",
|
| extension->GetType(), 100);
|
| RecordPermissionMessagesHistogram(
|
| @@ -2264,8 +2245,7 @@ void ExtensionService::OnExtensionInstalled(
|
| }
|
|
|
| const Extension* ExtensionService::GetExtensionByIdInternal(
|
| - const std::string& id, bool include_enabled, bool include_disabled,
|
| - bool include_terminated) const {
|
| + const std::string& id, bool include_enabled, bool include_disabled) const {
|
| std::string lowercase_id = StringToLowerASCII(id);
|
| if (include_enabled) {
|
| const Extension* extension = extensions_.GetByID(lowercase_id);
|
| @@ -2277,34 +2257,12 @@ const Extension* ExtensionService::GetExtensionByIdInternal(
|
| if (extension)
|
| return extension;
|
| }
|
| - if (include_terminated) {
|
| - const Extension* extension = terminated_extensions_.GetByID(lowercase_id);
|
| - if (extension)
|
| - return extension;
|
| - }
|
| return NULL;
|
| }
|
|
|
| -void ExtensionService::TrackTerminatedExtension(const Extension* extension) {
|
| - if (!terminated_extensions_.Contains(extension->id()))
|
| - terminated_extensions_.Insert(make_scoped_refptr(extension));
|
| -
|
| - UnloadExtension(extension->id(), extension_misc::UNLOAD_REASON_TERMINATE);
|
| -}
|
| -
|
| -void ExtensionService::UntrackTerminatedExtension(const std::string& id) {
|
| - std::string lowercase_id = StringToLowerASCII(id);
|
| - terminated_extensions_.Remove(lowercase_id);
|
| -}
|
| -
|
| -const Extension* ExtensionService::GetTerminatedExtension(
|
| - const std::string& id) const {
|
| - return GetExtensionByIdInternal(id, false, false, true);
|
| -}
|
| -
|
| const Extension* ExtensionService::GetInstalledExtension(
|
| const std::string& id) const {
|
| - return GetExtensionByIdInternal(id, true, true, true);
|
| + return GetExtensionByIdInternal(id, true, true);
|
| }
|
|
|
| const Extension* ExtensionService::GetWebStoreApp() {
|
| @@ -2419,27 +2377,6 @@ void ExtensionService::Observe(int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| switch (type) {
|
| - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: {
|
| - if (profile_ !=
|
| - content::Source<Profile>(source).ptr()->GetOriginalProfile()) {
|
| - break;
|
| - }
|
| -
|
| - ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
|
| -
|
| - // Mark the extension as terminated and Unload it. We want it to
|
| - // be in a consistent state: either fully working or not loaded
|
| - // at all, but never half-crashed. We do it in a PostTask so
|
| - // that other handlers of this notification will still have
|
| - // access to the Extension and ExtensionHost.
|
| - MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(
|
| - &ExtensionService::TrackTerminatedExtension,
|
| - AsWeakPtr(),
|
| - host->extension()));
|
| - break;
|
| - }
|
| case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
|
| content::RenderProcessHost* process =
|
| content::Source<content::RenderProcessHost>(source).ptr();
|
|
|