| 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/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/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/common/extensions/extension_manifest_constants.h" | 9 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 10 #include "chrome/common/extensions/extension_messages.h" | 10 #include "chrome/common/extensions/extension_messages.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // We recheck access here in the renderer for extra safety against races | 168 // We recheck access here in the renderer for extra safety against races |
| 169 // with navigation. | 169 // with navigation. |
| 170 // | 170 // |
| 171 // But different frames can have different URLs, and the extension might | 171 // But different frames can have different URLs, and the extension might |
| 172 // only have access to a subset of them. For the top frame, we can | 172 // only have access to a subset of them. For the top frame, we can |
| 173 // immediately send an error and stop because the browser process | 173 // immediately send an error and stop because the browser process |
| 174 // considers that an error too. | 174 // considers that an error too. |
| 175 // | 175 // |
| 176 // For child frames, we just skip ones the extension doesn't have access | 176 // For child frames, we just skip ones the extension doesn't have access |
| 177 // to and carry on. | 177 // to and carry on. |
| 178 if (!extension->CanExecuteScriptOnPage(child_frame->document().url(), | 178 if (!params.is_web_view && |
| 179 !extension->CanExecuteScriptOnPage(child_frame->document().url(), |
| 179 frame_->document().url(), | 180 frame_->document().url(), |
| 180 extension_helper->tab_id(), | 181 extension_helper->tab_id(), |
| 181 NULL, | 182 NULL, |
| 182 NULL)) { | 183 NULL)) { |
| 183 if (child_frame->parent()) { | 184 if (child_frame->parent()) { |
| 184 continue; | 185 continue; |
| 185 } else { | 186 } else { |
| 186 error = ErrorUtils::FormatErrorMessage( | 187 error = ErrorUtils::FormatErrorMessage( |
| 187 extension_manifest_errors::kCannotAccessPage, | 188 extension_manifest_errors::kCannotAccessPage, |
| 188 child_frame->document().url().spec()); | 189 child_frame->document().url().spec()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 250 |
| 250 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; | 251 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; |
| 251 child_frame = child_frame->nextSibling()) { | 252 child_frame = child_frame->nextSibling()) { |
| 252 frames_vector->push_back(child_frame); | 253 frames_vector->push_back(child_frame); |
| 253 GetAllChildFrames(child_frame, frames_vector); | 254 GetAllChildFrames(child_frame, frames_vector); |
| 254 } | 255 } |
| 255 return true; | 256 return true; |
| 256 } | 257 } |
| 257 | 258 |
| 258 } // namespace extensions | 259 } // namespace extensions |
| OLD | NEW |