Chromium Code Reviews| 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, |