OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_IDLE_SCHEDULER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_IDLE_SCHEDULER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_IDLE_SCHEDULER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_IDLE_SCHEDULER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/task.h" | 13 #include "base/memory/weak_ptr.h" |
14 | 14 |
15 class ExtensionDispatcher; | 15 class ExtensionDispatcher; |
16 class RenderView; | 16 class RenderView; |
17 struct ExtensionMsg_ExecuteCode_Params; | 17 struct ExtensionMsg_ExecuteCode_Params; |
18 | 18 |
19 namespace WebKit { | 19 namespace WebKit { |
20 class WebFrame; | 20 class WebFrame; |
21 } | 21 } |
22 | 22 |
23 // Implements support for injecting scripts at "document idle". Currently, | 23 // Implements support for injecting scripts at "document idle". Currently, |
(...skipping 29 matching lines...) Expand all Loading... |
53 void MaybeRun(); | 53 void MaybeRun(); |
54 | 54 |
55 // Backend for the IPC Message ExecuteCode in addition to being used | 55 // Backend for the IPC Message ExecuteCode in addition to being used |
56 // internally. | 56 // internally. |
57 void ExecuteCodeImpl(const ExtensionMsg_ExecuteCode_Params& params); | 57 void ExecuteCodeImpl(const ExtensionMsg_ExecuteCode_Params& params); |
58 | 58 |
59 // Get all child frames of parent_frame, returned by frames_vector. | 59 // Get all child frames of parent_frame, returned by frames_vector. |
60 bool GetAllChildFrames(WebKit::WebFrame* parent_frame, | 60 bool GetAllChildFrames(WebKit::WebFrame* parent_frame, |
61 std::vector<WebKit::WebFrame*>* frames_vector) const; | 61 std::vector<WebKit::WebFrame*>* frames_vector) const; |
62 | 62 |
63 ScopedRunnableMethodFactory<UserScriptIdleScheduler> method_factory_; | 63 base::WeakPtrFactory<UserScriptIdleScheduler> weak_factory_; |
64 | 64 |
65 // The Frame we will run scripts in. | 65 // The Frame we will run scripts in. |
66 WebKit::WebFrame* frame_; | 66 WebKit::WebFrame* frame_; |
67 | 67 |
68 // Whether we have already run scripts. | 68 // Whether we have already run scripts. |
69 bool has_run_; | 69 bool has_run_; |
70 | 70 |
71 // This is only used if we're for the main frame. | 71 // This is only used if we're for the main frame. |
72 std::queue<linked_ptr<ExtensionMsg_ExecuteCode_Params> > | 72 std::queue<linked_ptr<ExtensionMsg_ExecuteCode_Params> > |
73 pending_code_execution_queue_; | 73 pending_code_execution_queue_; |
74 | 74 |
75 ExtensionDispatcher* extension_dispatcher_; | 75 ExtensionDispatcher* extension_dispatcher_; |
76 }; | 76 }; |
77 | 77 |
78 #endif // CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_IDLE_SCHEDULER_H_ | 78 #endif // CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_IDLE_SCHEDULER_H_ |
OLD | NEW |