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

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: 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..47a5027a6b51fdca9b26e60cdae7fa1ec91c28e8 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,35 @@ bool ChromeContentBrowserClientPluginsPart::AllowPepperSocketAPI(
#endif
}
+bool ChromeContentBrowserClientPluginsPart::AllowPepperVpnProviderAPI(
+ content::BrowserContext* browser_context,
+ const GURL& url) {
+#if defined(ENABLE_EXTENSIONS)
+ Profile* profile = Profile::FromBrowserContext(browser_context);
sky 2016/05/17 19:08:37 early return if !profile.
adrian.belgun 2016/05/17 20:13:32 Done.
+ const extensions::ExtensionSet* extension_set = NULL;
sky 2016/05/17 19:08:37 nullptr
adrian.belgun 2016/05/17 20:13:31 Refactored.
+ if (profile) {
+ extension_set =
+ &extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
+ }
+
+ // Access to the vpnProvider API is controlled by extension permissions.
+ if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) &&
+ extension_set) {
+ const extensions::Extension* extension = extension_set->GetByID(url.host());
+ if (extension) {
+ const extensions::PermissionsData* permissions_data =
+ extension->permissions_data();
+ if (permissions_data->HasAPIPermission(
+ extensions::APIPermission::kVpnProvider)) {
+ return true;
+ }
+ }
+ }
+#endif
+
+ return false;
+}
+
bool ChromeContentBrowserClientPluginsPart::IsPluginAllowedToUseDevChannelAPIs(
content::BrowserContext* browser_context,
const GURL& url,

Powered by Google App Engine
This is Rietveld 408576698