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 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 ExecuteCodeInTabFunction(); | 25 ExecuteCodeInTabFunction(); |
26 | 26 |
27 protected: | 27 protected: |
28 virtual ~ExecuteCodeInTabFunction(); | 28 virtual ~ExecuteCodeInTabFunction(); |
29 | 29 |
30 // ExtensionFunction: | 30 // ExtensionFunction: |
31 virtual bool HasPermission() OVERRIDE; | 31 virtual bool HasPermission() OVERRIDE; |
32 virtual bool RunImpl() OVERRIDE; | 32 virtual bool RunImpl() OVERRIDE; |
33 | 33 |
34 // Message handler. | 34 // Message handler. |
35 virtual void OnExecuteCodeFinished(bool success, | 35 virtual void OnExecuteCodeFinished(const std::string& error, |
36 int32 page_id, | 36 int32 on_page_id, |
37 const std::string& error, | 37 const GURL& on_url, |
38 const ListValue& script_result); | 38 const ListValue& script_result); |
39 | 39 |
40 private: | 40 private: |
41 // Initialize the |execute_tab_id_| and |details_| if they haven't already | 41 // Initialize the |execute_tab_id_| and |details_| if they haven't already |
42 // been. Returns whether initialization was successful. | 42 // been. Returns whether initialization was successful. |
43 bool Init(); | 43 bool Init(); |
44 | 44 |
45 // Called when contents from the file whose path is specified in JSON | 45 // Called when contents from the file whose path is specified in JSON |
46 // arguments has been loaded. | 46 // arguments has been loaded. |
47 void DidLoadFile(bool success, const std::string& data); | 47 void DidLoadFile(bool success, const std::string& data); |
(...skipping 21 matching lines...) Expand all Loading... |
69 | 69 |
70 // Contains extension resource built from path of file which is | 70 // Contains extension resource built from path of file which is |
71 // specified in JSON arguments. | 71 // specified in JSON arguments. |
72 ExtensionResource resource_; | 72 ExtensionResource resource_; |
73 }; | 73 }; |
74 | 74 |
75 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { | 75 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { |
76 private: | 76 private: |
77 virtual ~TabsExecuteScriptFunction() {} | 77 virtual ~TabsExecuteScriptFunction() {} |
78 | 78 |
79 virtual void OnExecuteCodeFinished(bool success, int32 page_id, | 79 virtual void OnExecuteCodeFinished(const std::string& error, |
80 const std::string& error, | 80 int32 on_page_id, |
| 81 const GURL& on_url, |
81 const ListValue& script_result) OVERRIDE; | 82 const ListValue& script_result) OVERRIDE; |
82 | 83 |
83 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") | 84 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") |
84 }; | 85 }; |
85 | 86 |
86 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { | 87 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { |
87 private: | 88 private: |
88 virtual ~TabsInsertCSSFunction() {} | 89 virtual ~TabsInsertCSSFunction() {} |
89 | 90 |
90 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") | 91 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") |
91 }; | 92 }; |
92 | 93 |
93 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 94 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
OLD | NEW |