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

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: Respond to reviews. 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..e9497cdd66d16df466bccaefce8e9eafefb2421a 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,37 @@ 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) {
sky 2016/05/17 21:12:40 nit: no {}
adrian.belgun 2016/05/18 09:09:54 Done.
+ return false;
+ }
+ const extensions::ExtensionSet* extension_set =
+ &extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
+ if (!extension_set) {
sky 2016/05/17 21:12:39 nit: no {}
adrian.belgun 2016/05/18 09:09:54 Done.
+ 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) {
+ const extensions::PermissionsData* permissions_data =
+ extension->permissions_data();
+ if (permissions_data->HasAPIPermission(
bbudge 2016/05/18 07:28:35 nit: Instead of local permissions_data, just: if
adrian.belgun 2016/05/18 09:09:54 Done.
+ 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