Index: chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc |
diff --git a/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc b/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc |
index d0caa3f6df30c85315610f311c3f448971d5d6e7..70ffc9b28959e89ff434679bbe540e44e901af07 100644 |
--- a/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc |
+++ b/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc |
@@ -113,6 +113,34 @@ bool ChromeContentBrowserClientPluginsPart::AllowPepperSocketAPI( |
#endif |
} |
+bool ChromeContentBrowserClientPluginsPart::IsPepperVpnProviderAPIAllowed( |
+ content::BrowserContext* browser_context, |
+ const GURL& url) { |
+#if defined(ENABLE_EXTENSIONS) |
+ Profile* profile = Profile::FromBrowserContext(browser_context); |
+ if (!profile) |
+ return false; |
+ |
+ const extensions::ExtensionSet* extension_set = |
+ &extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); |
+ if (!extension_set) |
+ return false; |
+ |
+ // Access to the vpnProvider API is controlled by extension permissions. |
+ if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme)) { |
+ const extensions::Extension* extension = extension_set->GetByID(url.host()); |
+ if (extension) { |
+ if (extension->permissions_data()->HasAPIPermission( |
+ extensions::APIPermission::kVpnProvider)) { |
+ return true; |
+ } |
+ } |
+ } |
+#endif |
+ |
+ return false; |
+} |
+ |
bool ChromeContentBrowserClientPluginsPart::IsPluginAllowedToUseDevChannelAPIs( |
content::BrowserContext* browser_context, |
const GURL& url, |