Chromium Code Reviews| Index: extensions/common/permissions/permissions_data.cc |
| diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc |
| index 59428b658e7c650b945a0a72b99e700b4b763a66..af161555e3f747cb893fe924db8d9e5b439f35bd 100644 |
| --- a/extensions/common/permissions/permissions_data.cc |
| +++ b/extensions/common/permissions/permissions_data.cc |
| @@ -537,27 +537,32 @@ bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) { |
| // static |
| bool PermissionsData::CanCaptureVisiblePage(const Extension* extension, |
| - const GURL& page_url, |
| int tab_id, |
| std::string* error) { |
| - if (tab_id >= 0) { |
| + scoped_refptr<const PermissionSet> active_permissions = |
| + GetActivePermissions(extension); |
| + const URLPattern all_urls(URLPattern::SCHEME_ALL, |
| + URLPattern::kAllUrlsPattern); |
| + if (active_permissions && |
|
not at google - send to devlin
2014/01/23 20:16:35
it's the tab-specific permissions that need null c
sadrul
2014/01/23 20:23:49
More likely I misunderstood. Fixed
|
| + active_permissions->explicit_hosts().ContainsPattern(all_urls)) { |
| + return true; |
| + } |
| + |
| + if (tab_id >= 0 && |
| + HasAPIPermission(extension, APIPermission::kActiveTab)) { |
|
not at google - send to devlin
2014/01/23 20:16:35
I think this check is unnecessary. Just let the Ac
sadrul
2014/01/23 20:23:49
Done.
|
| scoped_refptr<const PermissionSet> tab_permissions = |
| GetTabSpecificPermissions(extension, tab_id); |
| - if (tab_permissions.get() && |
| - tab_permissions->explicit_hosts().MatchesSecurityOrigin(page_url)) { |
| + if (tab_permissions && |
| + tab_permissions->HasAPIPermission(APIPermission::kTab)) { |
| return true; |
| } |
| + if (error) |
| + *error = errors::kActiveTabPermissionNotGranted; |
| + return false; |
| } |
| - if (HasHostPermission(extension, page_url) || |
| - page_url.GetOrigin() == extension->url()) { |
| - return true; |
| - } |
| - |
| - if (error) { |
| - *error = ErrorUtils::FormatErrorMessage(errors::kCannotAccessPage, |
| - page_url.spec()); |
| - } |
| + if (error) |
| + *error = errors::kAllURLOrActiveTabNeeded; |
| return false; |
| } |