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 |
33 UserScriptScheduler::UserScriptScheduler( | 34 UserScriptScheduler::UserScriptScheduler( |
34 WebFrame* frame, ExtensionDispatcher* extension_dispatcher) | 35 WebFrame* frame, ExtensionDispatcher* extension_dispatcher) |
35 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 36 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
36 frame_(frame), | 37 frame_(frame), |
37 current_location_(UserScript::UNDEFINED), | 38 current_location_(UserScript::UNDEFINED), |
38 has_run_idle_(false), | 39 has_run_idle_(false), |
39 extension_dispatcher_(extension_dispatcher) { | 40 extension_dispatcher_(extension_dispatcher) { |
40 for (int i = UserScript::UNDEFINED; i < UserScript::RUN_LOCATION_LAST; ++i) { | 41 for (int i = UserScript::UNDEFINED; i < UserScript::RUN_LOCATION_LAST; ++i) { |
41 pending_execution_map_[static_cast<UserScript::RunLocation>(i)] = | 42 pending_execution_map_[static_cast<UserScript::RunLocation>(i)] = |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (!parent_frame) | 204 if (!parent_frame) |
204 return false; | 205 return false; |
205 | 206 |
206 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; | 207 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; |
207 child_frame = child_frame->nextSibling()) { | 208 child_frame = child_frame->nextSibling()) { |
208 frames_vector->push_back(child_frame); | 209 frames_vector->push_back(child_frame); |
209 GetAllChildFrames(child_frame, frames_vector); | 210 GetAllChildFrames(child_frame, frames_vector); |
210 } | 211 } |
211 return true; | 212 return true; |
212 } | 213 } |
OLD | NEW |