| 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/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "chrome/common/chrome_switches.h" | 82 #include "chrome/common/chrome_switches.h" |
| 83 #include "chrome/common/chrome_version_info.h" | 83 #include "chrome/common/chrome_version_info.h" |
| 84 #include "chrome/common/extensions/extension.h" | 84 #include "chrome/common/extensions/extension.h" |
| 85 #include "chrome/common/extensions/extension_file_util.h" | 85 #include "chrome/common/extensions/extension_file_util.h" |
| 86 #include "chrome/common/extensions/extension_manifest_constants.h" | 86 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 87 #include "chrome/common/extensions/extension_messages.h" | 87 #include "chrome/common/extensions/extension_messages.h" |
| 88 #include "chrome/common/extensions/extension_resource.h" | 88 #include "chrome/common/extensions/extension_resource.h" |
| 89 #include "chrome/common/extensions/feature_switch.h" | 89 #include "chrome/common/extensions/feature_switch.h" |
| 90 #include "chrome/common/extensions/features/feature.h" | 90 #include "chrome/common/extensions/features/feature.h" |
| 91 #include "chrome/common/extensions/manifest.h" | 91 #include "chrome/common/extensions/manifest.h" |
| 92 #include "chrome/common/extensions/manifest_url_info.h" |
| 92 #include "chrome/common/pref_names.h" | 93 #include "chrome/common/pref_names.h" |
| 93 #include "chrome/common/url_constants.h" | 94 #include "chrome/common/url_constants.h" |
| 94 #include "content/public/browser/browser_thread.h" | 95 #include "content/public/browser/browser_thread.h" |
| 95 #include "content/public/browser/devtools_agent_host.h" | 96 #include "content/public/browser/devtools_agent_host.h" |
| 96 #include "content/public/browser/devtools_manager.h" | 97 #include "content/public/browser/devtools_manager.h" |
| 97 #include "content/public/browser/notification_service.h" | 98 #include "content/public/browser/notification_service.h" |
| 98 #include "content/public/browser/notification_types.h" | 99 #include "content/public/browser/notification_types.h" |
| 99 #include "content/public/browser/plugin_service.h" | 100 #include "content/public/browser/plugin_service.h" |
| 100 #include "content/public/browser/render_process_host.h" | 101 #include "content/public/browser/render_process_host.h" |
| 101 #include "content/public/browser/site_instance.h" | 102 #include "content/public/browser/site_instance.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 121 | 122 |
| 122 using content::BrowserContext; | 123 using content::BrowserContext; |
| 123 using content::BrowserThread; | 124 using content::BrowserThread; |
| 124 using content::DevToolsAgentHost; | 125 using content::DevToolsAgentHost; |
| 125 using content::PluginService; | 126 using content::PluginService; |
| 126 using extensions::CrxInstaller; | 127 using extensions::CrxInstaller; |
| 127 using extensions::Extension; | 128 using extensions::Extension; |
| 128 using extensions::ExtensionIdSet; | 129 using extensions::ExtensionIdSet; |
| 129 using extensions::ExtensionInfo; | 130 using extensions::ExtensionInfo; |
| 130 using extensions::FeatureSwitch; | 131 using extensions::FeatureSwitch; |
| 132 using extensions::ManifestURLInfo; |
| 131 using extensions::PermissionMessage; | 133 using extensions::PermissionMessage; |
| 132 using extensions::PermissionMessages; | 134 using extensions::PermissionMessages; |
| 133 using extensions::PermissionSet; | 135 using extensions::PermissionSet; |
| 134 using extensions::UnloadedExtensionInfo; | 136 using extensions::UnloadedExtensionInfo; |
| 135 | 137 |
| 136 namespace errors = extension_manifest_errors; | 138 namespace errors = extension_manifest_errors; |
| 137 | 139 |
| 138 namespace { | 140 namespace { |
| 139 | 141 |
| 140 // Histogram values for logging events related to externally installed | 142 // Histogram values for logging events related to externally installed |
| (...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 | 2347 |
| 2346 const std::string& id = extension->id(); | 2348 const std::string& id = extension->id(); |
| 2347 bool initial_enable = ShouldEnableOnInstall(extension); | 2349 bool initial_enable = ShouldEnableOnInstall(extension); |
| 2348 const extensions::PendingExtensionInfo* pending_extension_info = NULL; | 2350 const extensions::PendingExtensionInfo* pending_extension_info = NULL; |
| 2349 if ((pending_extension_info = pending_extension_manager()->GetById(id))) { | 2351 if ((pending_extension_info = pending_extension_manager()->GetById(id))) { |
| 2350 if (!pending_extension_info->ShouldAllowInstall(*extension)) { | 2352 if (!pending_extension_info->ShouldAllowInstall(*extension)) { |
| 2351 pending_extension_manager()->Remove(id); | 2353 pending_extension_manager()->Remove(id); |
| 2352 | 2354 |
| 2353 LOG(WARNING) << "ShouldAllowInstall() returned false for " | 2355 LOG(WARNING) << "ShouldAllowInstall() returned false for " |
| 2354 << id << " of type " << extension->GetType() | 2356 << id << " of type " << extension->GetType() |
| 2355 << " and update URL " << extension->update_url().spec() | 2357 << " and update URL " |
| 2358 << ManifestURLInfo::GetUpdateURL(extension).spec() |
| 2356 << "; not installing"; | 2359 << "; not installing"; |
| 2357 | 2360 |
| 2358 content::NotificationService::current()->Notify( | 2361 content::NotificationService::current()->Notify( |
| 2359 chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, | 2362 chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, |
| 2360 content::Source<Profile>(profile_), | 2363 content::Source<Profile>(profile_), |
| 2361 content::Details<const Extension>(extension)); | 2364 content::Details<const Extension>(extension)); |
| 2362 | 2365 |
| 2363 // Delete the extension directory since we're not going to | 2366 // Delete the extension directory since we're not going to |
| 2364 // load it. | 2367 // load it. |
| 2365 if (!GetFileTaskRunner()->PostTask( | 2368 if (!GetFileTaskRunner()->PostTask( |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3122 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); | 3125 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); |
| 3123 DCHECK(extension); | 3126 DCHECK(extension); |
| 3124 if (!extension) | 3127 if (!extension) |
| 3125 continue; | 3128 continue; |
| 3126 blacklisted_extensions_.Insert(extension); | 3129 blacklisted_extensions_.Insert(extension); |
| 3127 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); | 3130 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); |
| 3128 } | 3131 } |
| 3129 | 3132 |
| 3130 IdentifyAlertableExtensions(); | 3133 IdentifyAlertableExtensions(); |
| 3131 } | 3134 } |
| OLD | NEW |