| 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_error_utils.h" | 9 #include "chrome/common/extensions/extension_error_utils.h" |
| 10 #include "chrome/common/extensions/extension_manifest_constants.h" | 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace { | 22 namespace { |
| 23 // The length of time to wait after the DOM is complete to try and run user | 23 // The length of time to wait after the DOM is complete to try and run user |
| 24 // scripts. | 24 // scripts. |
| 25 const int kUserScriptIdleTimeoutMs = 200; | 25 const int kUserScriptIdleTimeoutMs = 200; |
| 26 } | 26 } |
| 27 | 27 |
| 28 using WebKit::WebDocument; | 28 using WebKit::WebDocument; |
| 29 using WebKit::WebFrame; | 29 using WebKit::WebFrame; |
| 30 using WebKit::WebString; | 30 using WebKit::WebString; |
| 31 using WebKit::WebView; | 31 using WebKit::WebView; |
| 32 using extensions::Extension; | 32 |
| 33 namespace extensions { |
| 33 | 34 |
| 34 UserScriptScheduler::UserScriptScheduler( | 35 UserScriptScheduler::UserScriptScheduler( |
| 35 WebFrame* frame, ExtensionDispatcher* extension_dispatcher) | 36 WebFrame* frame, ExtensionDispatcher* extension_dispatcher) |
| 36 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 37 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 37 frame_(frame), | 38 frame_(frame), |
| 38 current_location_(UserScript::UNDEFINED), | 39 current_location_(UserScript::UNDEFINED), |
| 39 has_run_idle_(false), | 40 has_run_idle_(false), |
| 40 extension_dispatcher_(extension_dispatcher) { | 41 extension_dispatcher_(extension_dispatcher) { |
| 41 for (int i = UserScript::UNDEFINED; i < UserScript::RUN_LOCATION_LAST; ++i) { | 42 for (int i = UserScript::UNDEFINED; i < UserScript::RUN_LOCATION_LAST; ++i) { |
| 42 pending_execution_map_[static_cast<UserScript::RunLocation>(i)] = | 43 pending_execution_map_[static_cast<UserScript::RunLocation>(i)] = |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 if (!parent_frame) | 215 if (!parent_frame) |
| 215 return false; | 216 return false; |
| 216 | 217 |
| 217 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; | 218 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; |
| 218 child_frame = child_frame->nextSibling()) { | 219 child_frame = child_frame->nextSibling()) { |
| 219 frames_vector->push_back(child_frame); | 220 frames_vector->push_back(child_frame); |
| 220 GetAllChildFrames(child_frame, frames_vector); | 221 GetAllChildFrames(child_frame, frames_vector); |
| 221 } | 222 } |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 225 |
| 226 } // namespace extensions |
| OLD | NEW |