| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_idle_scheduler.h" | 5 #include "chrome/renderer/extensions/user_script_idle_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_messages.h" | 10 #include "chrome/common/extensions/extension_messages.h" |
| 11 #include "chrome/renderer/extensions/extension_dispatcher.h" | 11 #include "chrome/renderer/extensions/extension_dispatcher.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return; | 49 return; |
| 50 } | 50 } |
| 51 | 51 |
| 52 ExecuteCodeImpl(params); | 52 ExecuteCodeImpl(params); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void UserScriptIdleScheduler::DidFinishDocumentLoad() { | 55 void UserScriptIdleScheduler::DidFinishDocumentLoad() { |
| 56 MessageLoop::current()->PostDelayedTask( | 56 MessageLoop::current()->PostDelayedTask( |
| 57 FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun, | 57 FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun, |
| 58 weak_factory_.GetWeakPtr()), | 58 weak_factory_.GetWeakPtr()), |
| 59 base::TimeDelta::FromMilliseconds(kUserScriptIdleTimeoutMs)); | 59 kUserScriptIdleTimeoutMs); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void UserScriptIdleScheduler::DidFinishLoad() { | 62 void UserScriptIdleScheduler::DidFinishLoad() { |
| 63 // Ensure that running scripts does not keep any progress UI running. | 63 // Ensure that running scripts does not keep any progress UI running. |
| 64 MessageLoop::current()->PostTask( | 64 MessageLoop::current()->PostTask( |
| 65 FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun, | 65 FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun, |
| 66 weak_factory_.GetWeakPtr())); | 66 weak_factory_.GetWeakPtr())); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void UserScriptIdleScheduler::DidStartProvisionalLoad() { | 69 void UserScriptIdleScheduler::DidStartProvisionalLoad() { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (!parent_frame) | 173 if (!parent_frame) |
| 174 return false; | 174 return false; |
| 175 | 175 |
| 176 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; | 176 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; |
| 177 child_frame = child_frame->nextSibling()) { | 177 child_frame = child_frame->nextSibling()) { |
| 178 frames_vector->push_back(child_frame); | 178 frames_vector->push_back(child_frame); |
| 179 GetAllChildFrames(child_frame, frames_vector); | 179 GetAllChildFrames(child_frame, frames_vector); |
| 180 } | 180 } |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| OLD | NEW |