| 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/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" |
| 11 #include "chrome/renderer/extensions/chrome_v8_context.h" | 11 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| 12 #include "chrome/renderer/extensions/dispatcher.h" | 12 #include "chrome/renderer/extensions/dispatcher.h" |
| 13 #include "chrome/renderer/extensions/dom_activity_logger.h" | 13 #include "chrome/renderer/extensions/dom_activity_logger.h" |
| 14 #include "chrome/renderer/extensions/extension_groups.h" | 14 #include "chrome/renderer/extensions/extension_groups.h" |
| 15 #include "chrome/renderer/extensions/extension_helper.h" | 15 #include "chrome/renderer/extensions/extension_helper.h" |
| 16 #include "chrome/renderer/extensions/user_script_slave.h" | 16 #include "chrome/renderer/extensions/user_script_slave.h" |
| 17 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
| 18 #include "content/public/renderer/v8_value_converter.h" | 18 #include "content/public/renderer/v8_value_converter.h" |
| 19 #include "extensions/common/error_utils.h" | 19 #include "extensions/common/error_utils.h" |
| 20 #include "extensions/common/extension_messages.h" | 20 #include "extensions/common/extension_messages.h" |
| 21 #include "extensions/common/manifest_constants.h" | 21 #include "extensions/common/manifest_constants.h" |
| 22 #include "extensions/common/permissions/permissions_data.h" | 22 #include "extensions/common/permissions/permissions_data.h" |
| 23 #include "extensions/renderer/script_context.h" |
| 23 #include "third_party/WebKit/public/platform/WebString.h" | 24 #include "third_party/WebKit/public/platform/WebString.h" |
| 24 #include "third_party/WebKit/public/platform/WebVector.h" | 25 #include "third_party/WebKit/public/platform/WebVector.h" |
| 25 #include "third_party/WebKit/public/web/WebDocument.h" | 26 #include "third_party/WebKit/public/web/WebDocument.h" |
| 26 #include "third_party/WebKit/public/web/WebFrame.h" | 27 #include "third_party/WebKit/public/web/WebFrame.h" |
| 27 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 28 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
| 28 #include "third_party/WebKit/public/web/WebView.h" | 29 #include "third_party/WebKit/public/web/WebView.h" |
| 29 #include "v8/include/v8.h" | 30 #include "v8/include/v8.h" |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 // The length of time to wait after the DOM is complete to try and run user | 33 // The length of time to wait after the DOM is complete to try and run user |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 child_frame->document().insertStyleSheet( | 254 child_frame->document().insertStyleSheet( |
| 254 WebString::fromUTF8(params.code)); | 255 WebString::fromUTF8(params.code)); |
| 255 } | 256 } |
| 256 } | 257 } |
| 257 | 258 |
| 258 render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished( | 259 render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished( |
| 259 render_view->GetRoutingID(), | 260 render_view->GetRoutingID(), |
| 260 params.request_id, | 261 params.request_id, |
| 261 error, | 262 error, |
| 262 render_view->GetPageId(), | 263 render_view->GetPageId(), |
| 263 UserScriptSlave::GetDataSourceURLForFrame(frame_), | 264 ScriptContext::GetDataSourceURLForFrame(frame_), |
| 264 execution_results)); | 265 execution_results)); |
| 265 } | 266 } |
| 266 | 267 |
| 267 bool UserScriptScheduler::GetAllChildFrames( | 268 bool UserScriptScheduler::GetAllChildFrames( |
| 268 WebFrame* parent_frame, | 269 WebFrame* parent_frame, |
| 269 std::vector<WebFrame*>* frames_vector) const { | 270 std::vector<WebFrame*>* frames_vector) const { |
| 270 if (!parent_frame) | 271 if (!parent_frame) |
| 271 return false; | 272 return false; |
| 272 | 273 |
| 273 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; | 274 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; |
| 274 child_frame = child_frame->nextSibling()) { | 275 child_frame = child_frame->nextSibling()) { |
| 275 frames_vector->push_back(child_frame); | 276 frames_vector->push_back(child_frame); |
| 276 GetAllChildFrames(child_frame, frames_vector); | 277 GetAllChildFrames(child_frame, frames_vector); |
| 277 } | 278 } |
| 278 return true; | 279 return true; |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace extensions | 282 } // namespace extensions |
| OLD | NEW |