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

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

Issue 226043005: Fix webview.executeScript API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small changes are made. Created 6 years, 8 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
OLDNEW
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/renderer/extensions/user_script_scheduler.h" 5 #include "chrome/renderer/extensions/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 "chrome/renderer/chrome_render_process_observer.h" 10 #include "chrome/renderer/chrome_render_process_observer.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // We recheck access here in the renderer for extra safety against races 178 // We recheck access here in the renderer for extra safety against races
179 // with navigation. 179 // with navigation.
180 // 180 //
181 // But different frames can have different URLs, and the extension might 181 // But different frames can have different URLs, and the extension might
182 // only have access to a subset of them. For the top frame, we can 182 // only have access to a subset of them. For the top frame, we can
183 // immediately send an error and stop because the browser process 183 // immediately send an error and stop because the browser process
184 // considers that an error too. 184 // considers that an error too.
185 // 185 //
186 // For child frames, we just skip ones the extension doesn't have access 186 // For child frames, we just skip ones the extension doesn't have access
187 // to and carry on. 187 // to and carry on.
188 if (!params.is_web_view && 188
189 bool is_webview_src_matched =
190 child_frame->document().url().string().equals(
191 WebString::fromUTF8(params.webview_src));
not at google - send to devlin 2014/04/07 17:43:00 you should be able to use GURL == on this when eve
Xi Han 2014/04/07 21:03:37 Done.
192 if ((!params.is_web_view ||
193 (params.is_web_view && !is_webview_src_matched)) &&
189 !PermissionsData::CanExecuteScriptOnPage( 194 !PermissionsData::CanExecuteScriptOnPage(
not at google - send to devlin 2014/04/07 17:43:00 this is a very complex condition. Is there a way y
Xi Han 2014/04/07 21:03:37 Done.
190 extension, 195 extension,
191 child_frame->document().url(), 196 child_frame->document().url(),
192 frame_->document().url(), 197 frame_->document().url(),
193 extension_helper->tab_id(), 198 extension_helper->tab_id(),
194 NULL, 199 NULL,
195 -1, 200 -1,
196 NULL)) { 201 NULL)) {
197 if (child_frame->parent()) { 202 if (child_frame->parent()) {
198 continue; 203 continue;
199 } else { 204 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 270
266 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; 271 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame;
267 child_frame = child_frame->nextSibling()) { 272 child_frame = child_frame->nextSibling()) {
268 frames_vector->push_back(child_frame); 273 frames_vector->push_back(child_frame);
269 GetAllChildFrames(child_frame, frames_vector); 274 GetAllChildFrames(child_frame, frames_vector);
270 } 275 }
271 return true; 276 return true;
272 } 277 }
273 278
274 } // namespace extensions 279 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698