Chromium Code Reviews| Index: chrome/browser/extensions/active_tab_permission_granter.cc |
| diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc |
| index c2d0cd5edd5e9532c41a6d68d8eca6f982374f8c..258ee97c2a75a42d9caf015635e638cd0d06a00d 100644 |
| --- a/chrome/browser/extensions/active_tab_permission_granter.cc |
| +++ b/chrome/browser/extensions/active_tab_permission_granter.cc |
| @@ -45,19 +45,11 @@ void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { |
| const PermissionsData* permissions_data = extension->permissions_data(); |
| - // If the extension requires action for script execution, we grant it |
| + // If the extension requested all-hosts but has had it withheld, we grant it |
| // active tab-style permissions, even if it doesn't have the activeTab |
| // permission in the manifest. |
| - // We don't take tab id into account, because we want to know if the extension |
| - // should require active tab in general (not for the current tab). |
| - bool requires_action_for_script_execution = |
| - permissions_data->RequiresActionForScriptExecution(extension, |
| - -1, // No tab id. |
| - GURL()); |
| - |
| - if (extension->permissions_data()->HasAPIPermission( |
| - APIPermission::kActiveTab) || |
| - requires_action_for_script_execution) { |
| + if (permissions_data->HasAPIPermission(APIPermission::kActiveTab) || |
| + permissions_data->HasWithheldAllHosts()) { |
|
not at google - send to devlin
2014/06/30 14:37:03
could this second check be "permissions_data->CanA
Devlin
2014/06/30 17:06:09
Not really. Unless we overload GrantIfRequested t
not at google - send to devlin
2014/07/01 00:28:35
What's confusing about that? we already grab the U
Devlin
2014/07/01 16:27:05
I can see your point with all hosts vs web request
not at google - send to devlin
2014/07/01 17:02:11
It's a legitimate edge case, but it's a feature th
Devlin
2014/07/01 18:34:08
Done.
|
| URLPattern pattern(UserScript::ValidUserScriptSchemes()); |
| // Pattern parsing could fail if this is an unsupported URL e.g. chrome://. |
| if (pattern.Parse(web_contents()->GetURL().spec()) == |
| @@ -67,8 +59,7 @@ void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { |
| new_apis.insert(APIPermission::kTab); |
| } |
| - if (extension->permissions_data()->HasAPIPermission( |
| - APIPermission::kTabCapture)) |
| + if (permissions_data->HasAPIPermission(APIPermission::kTabCapture)) |
| new_apis.insert(APIPermission::kTabCaptureForTab); |
| if (!new_apis.empty() || !new_hosts.is_empty()) { |