Index: extensions/browser/api/vpn_provider/vpn_service.cc |
diff --git a/extensions/browser/api/vpn_provider/vpn_service.cc b/extensions/browser/api/vpn_provider/vpn_service.cc |
index 1e94b18fc73937a948ee328e69d538610abe8e27..608d25418c4453d502810a011f4c9927b1183ce1 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( |