diff options
author | kaliamoorthi <kaliamoorthi@chromium.org> | 2015-03-24 06:03:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-24 13:03:49 +0000 |
commit | b92b69ac6bbae38ad5af4a969d6f189349f399ce (patch) | |
tree | feeb81c71079eb34e51eea5eb2a396a6c2eea8e0 /extensions | |
parent | 6c6edea62387e69a5b9fd77fe6b3d0cc84fbad20 (diff) | |
download | chromium_src-b92b69ac6bbae38ad5af4a969d6f189349f399ce.zip chromium_src-b92b69ac6bbae38ad5af4a969d6f189349f399ce.tar.gz chromium_src-b92b69ac6bbae38ad5af4a969d6f189349f399ce.tar.bz2 |
Destroy configurations created by VPN extension on disable
The CL destroys VPN configurations created by an extension when
the extension is disabled.
BUG=468477
Review URL: https://codereview.chromium.org/1028213002
Cr-Commit-Position: refs/heads/master@{#321984}
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/browser/api/vpn_provider/vpn_service.cc | 27 | ||||
-rw-r--r-- | extensions/browser/api/vpn_provider/vpn_service.h | 4 |
2 files changed, 22 insertions, 9 deletions
diff --git a/extensions/browser/api/vpn_provider/vpn_service.cc b/extensions/browser/api/vpn_provider/vpn_service.cc index 1e94b18..608d254 100644 --- a/extensions/browser/api/vpn_provider/vpn_service.cc +++ b/extensions/browser/api/vpn_provider/vpn_service.cc @@ -431,15 +431,8 @@ bool VpnService::VerifyConfigIsConnectedForTesting( return DoesActiveConfigurationExistAndIsAccessAuthorized(extension_id); } -void VpnService::OnExtensionUninstalled( - content::BrowserContext* browser_context, - const extensions::Extension* extension, - extensions::UninstallReason reason) { - if (browser_context != browser_context_) { - NOTREACHED(); - return; - } - +void VpnService::DestroyConfigurationsForExtension( + const extensions::Extension* extension) { std::vector<VpnConfiguration*> to_be_destroyed; for (const auto& iter : key_to_configuration_map_) { if (iter.second->extension_id() == extension->id()) { @@ -455,6 +448,18 @@ void VpnService::OnExtensionUninstalled( } } +void VpnService::OnExtensionUninstalled( + content::BrowserContext* browser_context, + const extensions::Extension* extension, + extensions::UninstallReason reason) { + if (browser_context != browser_context_) { + NOTREACHED(); + return; + } + + DestroyConfigurationsForExtension(extension); +} + void VpnService::OnExtensionUnloaded( content::BrowserContext* browser_context, const extensions::Extension* extension, @@ -471,6 +476,10 @@ void VpnService::OnExtensionUnloaded( static_cast<uint32_t>(api_vpn::VPN_CONNECTION_STATE_FAILURE), base::Bind(base::DoNothing), base::Bind(DoNothingFailureCallback)); } + if (reason == extensions::UnloadedExtensionInfo::REASON_DISABLE || + reason == extensions::UnloadedExtensionInfo::REASON_BLACKLIST) { + DestroyConfigurationsForExtension(extension); + } } void VpnService::OnCreateConfigurationSuccess( diff --git a/extensions/browser/api/vpn_provider/vpn_service.h b/extensions/browser/api/vpn_provider/vpn_service.h index 25e9317..72c6240 100644 --- a/extensions/browser/api/vpn_provider/vpn_service.h +++ b/extensions/browser/api/vpn_provider/vpn_service.h @@ -215,6 +215,10 @@ class VpnService : public KeyedService, const std::string& event_name, scoped_ptr<base::ListValue> event_args); + // Destroy configurations belonging to the extension. + void DestroyConfigurationsForExtension( + const extensions::Extension* extension); + // Set the active configuration. void SetActiveConfiguration(VpnConfiguration* configuration); |