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 786d34df9c342447e2ab60ebf4fa3f03265e4ab4..6755384354b1384793e31b72bb5d167427b83255 100644 |
| --- a/extensions/common/permissions/permissions_data.cc |
| +++ b/extensions/common/permissions/permissions_data.cc |
| @@ -537,27 +537,25 @@ 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> tab_permissions = |
| - GetTabSpecificPermissions(extension, tab_id); |
| - if (tab_permissions.get() && |
| - tab_permissions->explicit_hosts().MatchesSecurityOrigin(page_url)) { |
| - return true; |
| - } |
| + scoped_refptr<const PermissionSet> tab_permissions = |
| + GetActivePermissions(extension); |
| + URLPattern all_urls(URLPattern::SCHEME_ALL); |
| + all_urls.SetMatchAllURLs(true); |
|
not at google - send to devlin
2014/01/16 17:48:26
you can construct this in a single line with
URLP
sadrul
2014/01/20 13:53:37
Done.
|
| + if (tab_permissions.get() && |
|
not at google - send to devlin
2014/01/16 17:48:26
I think there will always be active permissions, s
sadrul
2014/01/20 13:53:37
Done.
not at google - send to devlin
2014/01/21 21:44:21
I think I may have misread your code actually :\
sadrul
2014/01/23 20:11:14
Restored the null check for |tab_permissions|
|
| + tab_permissions->explicit_hosts().ContainsPattern(all_urls)) { |
| + return true; |
| } |
| - if (HasHostPermission(extension, page_url) || |
| - page_url.GetOrigin() == extension->url()) { |
| + if (tab_id >= 0 && |
| + HasAPIPermission(extension, APIPermission::kActiveTab) && |
| + GetTabSpecificPermissions(extension, tab_id)) { |
|
not at google - send to devlin
2014/01/16 17:48:26
I think the old check was what you want? the tab_p
sadrul
2014/01/20 13:53:37
If the extension has the |activeTab| permission, a
not at google - send to devlin
2014/01/21 21:44:21
I think you're right; the checks are actually effe
sadrul
2014/01/23 20:11:14
Yep, sounds good. Done.
|
| return true; |
| } |
| - if (error) { |
| - *error = ErrorUtils::FormatErrorMessage(errors::kCannotAccessPage, |
| - page_url.spec()); |
| - } |
| + if (error) |
| + *error = errors::kAllURLOrActiveTabNeeded; |
|
not at google - send to devlin
2014/01/16 17:48:26
hopefully developers won't be confused... "but I h
sadrul
2014/01/20 13:53:37
Done. (please let me know if you have suggestion a
|
| return false; |
| } |