Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Side by Side Diff: extensions/renderer/user_script_scheduler.cc

Issue 321533003: Separate PermissionsData::CanExecuteScriptOnPage into two functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/user_script_scheduler.h" 5 #include "extensions/renderer/user_script_scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // only have access to a subset of them. For the top frame, we can 185 // only have access to a subset of them. For the top frame, we can
186 // immediately send an error and stop because the browser process 186 // immediately send an error and stop because the browser process
187 // considers that an error too. 187 // considers that an error too.
188 // 188 //
189 // For child frames, we just skip ones the extension doesn't have access 189 // For child frames, we just skip ones the extension doesn't have access
190 // to and carry on. 190 // to and carry on.
191 191
192 GURL document_url = ScriptContext::GetEffectiveDocumentURL( 192 GURL document_url = ScriptContext::GetEffectiveDocumentURL(
193 child_frame, child_frame->document().url(), params.match_about_blank); 193 child_frame, child_frame->document().url(), params.match_about_blank);
194 bool can_execute_script = 194 bool can_execute_script =
195 extension->permissions_data()->CanExecuteScriptOnPage( 195 extension->permissions_data()->CanAccessPage(extension,
196 extension, 196 document_url,
197 document_url, 197 top_url,
198 top_url, 198 extension_helper->tab_id(),
199 extension_helper->tab_id(), 199 -1, // no process ID.
200 NULL, 200 NULL); // ignore error.
201 -1,
202 NULL);
203 if ((!params.is_web_view && !can_execute_script) || 201 if ((!params.is_web_view && !can_execute_script) ||
204 (params.is_web_view && document_url != params.webview_src)) { 202 (params.is_web_view && document_url != params.webview_src)) {
205 if (child_frame->parent()) { 203 if (child_frame->parent()) {
206 continue; 204 continue;
207 } else { 205 } else {
208 error = ErrorUtils::FormatErrorMessage( 206 error = ErrorUtils::FormatErrorMessage(
209 manifest_errors::kCannotAccessPage, document_url.spec()); 207 manifest_errors::kCannotAccessPage, document_url.spec());
210 break; 208 break;
211 } 209 }
212 } 210 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 272
275 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; 273 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame;
276 child_frame = child_frame->nextSibling()) { 274 child_frame = child_frame->nextSibling()) {
277 frames_vector->push_back(child_frame); 275 frames_vector->push_back(child_frame);
278 GetAllChildFrames(child_frame, frames_vector); 276 GetAllChildFrames(child_frame, frames_vector);
279 } 277 }
280 return true; 278 return true;
281 } 279 }
282 280
283 } // namespace extensions 281 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698