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/extension_action_runner.h" | 7 #include "chrome/browser/extensions/extension_action_runner.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "content/public/browser/navigation_entry.h" | 9 #include "content/public/browser/navigation_entry.h" |
10 #include "content/public/browser/navigation_handle.h" | 10 #include "content/public/browser/navigation_handle.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 void ActiveTabPermissionGranter::RevokeForTesting() { | 138 void ActiveTabPermissionGranter::RevokeForTesting() { |
139 ClearActiveExtensionsAndNotify(); | 139 ClearActiveExtensionsAndNotify(); |
140 } | 140 } |
141 | 141 |
142 void ActiveTabPermissionGranter::DidFinishNavigation( | 142 void ActiveTabPermissionGranter::DidFinishNavigation( |
143 content::NavigationHandle* navigation_handle) { | 143 content::NavigationHandle* navigation_handle) { |
144 // Important: sub-frames don't get granted! | 144 // Important: sub-frames don't get granted! |
145 if (!navigation_handle->IsInMainFrame() || | 145 if (!navigation_handle->IsInMainFrame() || |
146 !navigation_handle->HasCommitted() || | 146 !navigation_handle->HasCommitted() || |
147 navigation_handle->IsSamePage()) { | 147 navigation_handle->IsSameDocument()) { |
148 return; | 148 return; |
149 } | 149 } |
150 | 150 |
151 // Only clear the granted permissions for cross-origin navigations. | 151 // Only clear the granted permissions for cross-origin navigations. |
152 // | 152 // |
153 // See http://crbug.com/404243 for why. Currently we only differentiate | 153 // See http://crbug.com/404243 for why. Currently we only differentiate |
154 // between same-origin and cross-origin navigations when the | 154 // between same-origin and cross-origin navigations when the |
155 // script-require-action flag is on. It's not clear it's good for general | 155 // script-require-action flag is on. It's not clear it's good for general |
156 // activeTab consumption (we likely need to build some UI around it first). | 156 // activeTab consumption (we likely need to build some UI around it first). |
157 // However, the scripts-require-action feature is all-but unusable without | 157 // However, the scripts-require-action feature is all-but unusable without |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 CreateMessageFunction clear_message = | 202 CreateMessageFunction clear_message = |
203 base::Bind(&CreateClearMessage, extension_ids, tab_id_); | 203 base::Bind(&CreateClearMessage, extension_ids, tab_id_); |
204 SendMessageToProcesses(frame_hosts, | 204 SendMessageToProcesses(frame_hosts, |
205 web_contents()->GetRenderProcessHost(), | 205 web_contents()->GetRenderProcessHost(), |
206 clear_message); | 206 clear_message); |
207 | 207 |
208 granted_extensions_.Clear(); | 208 granted_extensions_.Clear(); |
209 } | 209 } |
210 | 210 |
211 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |