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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 virtual bool OnMessageReceived(const IPC::Message& message); | 26 virtual bool OnMessageReceived(const IPC::Message& message); |
27 | 27 |
28 // Message handler. | 28 // Message handler. |
29 void OnExecuteCodeFinished(int request_id, bool success, | 29 void OnExecuteCodeFinished(int request_id, bool success, |
30 const std::string& error); | 30 const std::string& error); |
31 | 31 |
32 // Called when contents from the file whose path is specified in JSON | 32 // Called when contents from the file whose path is specified in JSON |
33 // arguments has been loaded. | 33 // arguments has been loaded. |
34 void DidLoadFile(bool success, const std::string& data); | 34 void DidLoadFile(bool success, const std::string& data); |
35 | 35 |
| 36 // Runs on FILE thread. Loads message bundles for the extension and |
| 37 // localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread. |
| 38 void LocalizeCSS( |
| 39 const std::string& data, |
| 40 const std::string& extension_id, |
| 41 const FilePath& extension_path, |
| 42 const std::string& extension_default_locale); |
| 43 |
| 44 // Called when contents from the loaded file have been localized. |
| 45 void DidLoadAndLocalizeFile(bool success, const std::string& data); |
| 46 |
36 // Run in UI thread. Code string contains the code to be executed. Returns | 47 // Run in UI thread. Code string contains the code to be executed. Returns |
37 // true on success. If true is returned, this does an AddRef. | 48 // true on success. If true is returned, this does an AddRef. |
38 bool Execute(const std::string& code_string); | 49 bool Execute(const std::string& code_string); |
39 | 50 |
40 // Id of tab which executes code. | 51 // Id of tab which executes code. |
41 int execute_tab_id_; | 52 int execute_tab_id_; |
42 | 53 |
43 // Contains extension resource built from path of file which is | 54 // Contains extension resource built from path of file which is |
44 // specified in JSON arguments. | 55 // specified in JSON arguments. |
45 ExtensionResource resource_; | 56 ExtensionResource resource_; |
46 | 57 |
47 // If all_frames_ is true, script or CSS text would be injected | 58 // If all_frames_ is true, script or CSS text would be injected |
48 // to all frames; Otherwise only injected to top main frame. | 59 // to all frames; Otherwise only injected to top main frame. |
49 bool all_frames_; | 60 bool all_frames_; |
50 }; | 61 }; |
51 | 62 |
52 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { | 63 class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { |
53 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") | 64 DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") |
54 }; | 65 }; |
55 | 66 |
56 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { | 67 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { |
57 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") | 68 DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") |
58 }; | 69 }; |
59 | 70 |
60 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ | 71 #endif // CHROME_BROWSER_EXTENSIONS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ |
OLD | NEW |