Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1950)

Unified Diff: chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc

Issue 1985093002: ppapi: PPB_VpnProvider: Implement permission check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« no previous file with comments | « chrome/browser/plugins/chrome_content_browser_client_plugins_part.h ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698