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_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
12 #include "chrome/common/extensions/extension_resource.h" | 12 #include "chrome/common/extensions/extension_resource.h" |
| 13 #include "chrome/common/extensions/user_script.h" |
13 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
14 | 15 |
15 // Implement API call tabs.executeScript and tabs.insertCSS. | 16 // Implement API call tabs.executeScript and tabs.insertCSS. |
16 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, | 17 class ExecuteCodeInTabFunction : public AsyncExtensionFunction, |
17 public content::WebContentsObserver { | 18 public content::WebContentsObserver { |
18 public: | 19 public: |
19 ExecuteCodeInTabFunction(); | 20 ExecuteCodeInTabFunction(); |
20 virtual ~ExecuteCodeInTabFunction(); | 21 virtual ~ExecuteCodeInTabFunction(); |
21 | 22 |
22 private: | 23 private: |
(...skipping 28 matching lines...) Expand all Loading... |
51 // Id of tab which executes code. | 52 // Id of tab which executes code. |
52 int execute_tab_id_; | 53 int execute_tab_id_; |
53 | 54 |
54 // Contains extension resource built from path of file which is | 55 // Contains extension resource built from path of file which is |
55 // specified in JSON arguments. | 56 // specified in JSON arguments. |
56 ExtensionResource resource_; | 57 ExtensionResource resource_; |
57 | 58 |
58 // If all_frames_ is true, script or CSS text would be injected | 59 // If all_frames_ is true, script or CSS text would be injected |
59 // to all frames; Otherwise only injected to top main frame. | 60 // to all frames; Otherwise only injected to top main frame. |
60 bool all_frames_; | 61 bool all_frames_; |
| 62 |
| 63 // The intended time to run the script. |
| 64 UserScript::RunLocation run_at_; |
61 }; | 65 }; |
62 | 66 |
63 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { | 67 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { |
64 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") | 68 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") |
65 }; | 69 }; |
66 | 70 |
67 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { | 71 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { |
68 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") | 72 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") |
69 }; | 73 }; |
70 | 74 |
71 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 75 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
OLD | NEW |