| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 5 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/active_script_controller.h" | 7 #include "chrome/browser/extensions/active_script_controller.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "content/public/browser/navigation_details.h" | 9 #include "content/public/browser/navigation_details.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { | 36 void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { |
| 37 // Active tab grant request implies there was a user gesture. | 37 // Active tab grant request implies there was a user gesture. |
| 38 web_contents()->UserGestureDone(); | 38 web_contents()->UserGestureDone(); |
| 39 | 39 |
| 40 if (granted_extensions_.Contains(extension->id())) | 40 if (granted_extensions_.Contains(extension->id())) |
| 41 return; | 41 return; |
| 42 | 42 |
| 43 APIPermissionSet new_apis; | 43 APIPermissionSet new_apis; |
| 44 URLPatternSet new_hosts; | 44 URLPatternSet new_hosts; |
| 45 | 45 |
| 46 const PermissionsData* permissions_data = | 46 const PermissionsData* permissions_data = extension->permissions_data(); |
| 47 PermissionsData::ForExtension(extension); | |
| 48 | 47 |
| 49 // If the extension requires action for script execution, we grant it | 48 // If the extension requires action for script execution, we grant it |
| 50 // active tab-style permissions, even if it doesn't have the activeTab | 49 // active tab-style permissions, even if it doesn't have the activeTab |
| 51 // permission in the manifest. | 50 // permission in the manifest. |
| 52 // We don't take tab id into account, because we want to know if the extension | 51 // We don't take tab id into account, because we want to know if the extension |
| 53 // should require active tab in general (not for the current tab). | 52 // should require active tab in general (not for the current tab). |
| 54 bool requires_action_for_script_execution = | 53 bool requires_action_for_script_execution = |
| 55 permissions_data->RequiresActionForScriptExecution(extension, | 54 permissions_data->RequiresActionForScriptExecution(extension, |
| 56 -1, // No tab id. | 55 -1, // No tab id. |
| 57 GURL()); | 56 GURL()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 PermissionsData::ForExtension(it->get()) | 127 PermissionsData::ForExtension(it->get()) |
| 129 ->ClearTabSpecificPermissions(tab_id_); | 128 ->ClearTabSpecificPermissions(tab_id_); |
| 130 extension_ids.push_back((*it)->id()); | 129 extension_ids.push_back((*it)->id()); |
| 131 } | 130 } |
| 132 | 131 |
| 133 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); | 132 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); |
| 134 granted_extensions_.Clear(); | 133 granted_extensions_.Clear(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 } // namespace extensions | 136 } // namespace extensions |
| OLD | NEW |