| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "extensions/browser/extension_function.h" | 9 #include "extensions/browser/extension_function.h" |
| 10 #include "extensions/browser/script_executor.h" | 10 #include "extensions/browser/script_executor.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 const HostID& host_id() const { return host_id_; } | 48 const HostID& host_id() const { return host_id_; } |
| 49 void set_host_id(const HostID& host_id) { host_id_ = host_id; } | 49 void set_host_id(const HostID& host_id) { host_id_ = host_id; } |
| 50 | 50 |
| 51 // The injection details. | 51 // The injection details. |
| 52 std::unique_ptr<api::extension_types::InjectDetails> details_; | 52 std::unique_ptr<api::extension_types::InjectDetails> details_; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // Called when contents from the file whose path is specified in JSON | 55 // Called when contents from the file whose path is specified in JSON |
| 56 // arguments has been loaded. | 56 // arguments has been loaded. |
| 57 void DidLoadFile(bool success, std::unique_ptr<std::string> data); | 57 void DidLoadFile(bool success, |
| 58 const GURL& file_url, |
| 59 std::unique_ptr<std::string> data); |
| 60 |
| 61 // Runs on FILE thread. |
| 62 void GetFileURL(std::unique_ptr<std::string> data); |
| 58 | 63 |
| 59 // Runs on FILE thread. Loads message bundles for the extension and | 64 // Runs on FILE thread. Loads message bundles for the extension and |
| 60 // localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread. | 65 // localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread. |
| 61 void GetFileURLAndLocalizeCSS(ScriptExecutor::ScriptType script_type, | 66 void LocalizeCSS(std::unique_ptr<std::string> data, |
| 62 std::unique_ptr<std::string> data, | 67 const std::string& extension_id, |
| 63 const std::string& extension_id, | 68 const base::FilePath& extension_path, |
| 64 const base::FilePath& extension_path, | 69 const std::string& extension_default_locale); |
| 65 const std::string& extension_default_locale); | |
| 66 | 70 |
| 67 // Run in UI thread. Code string contains the code to be executed. Returns | 71 // Run in UI thread. Code string contains the code to be executed. Returns |
| 68 // true on success. If true is returned, this does an AddRef. | 72 // true on success. If true is returned, this does an AddRef. |
| 69 bool Execute(const std::string& code_string); | 73 bool Execute(const std::string& code_string); |
| 70 | 74 |
| 71 // Contains extension resource built from path of file which is | 75 // Contains extension resource built from path of file which is |
| 72 // specified in JSON arguments. | 76 // specified in JSON arguments. |
| 73 ExtensionResource resource_; | 77 ExtensionResource resource_; |
| 74 | 78 |
| 75 // The URL of the file being injected into the page. | 79 // The URL of the file being injected into the page. |
| 76 GURL file_url_; | 80 GURL file_url_; |
| 77 | 81 |
| 78 // The ID of the injection host. | 82 // The ID of the injection host. |
| 79 HostID host_id_; | 83 HostID host_id_; |
| 80 | 84 |
| 81 DISALLOW_COPY_AND_ASSIGN(ExecuteCodeFunction); | 85 DISALLOW_COPY_AND_ASSIGN(ExecuteCodeFunction); |
| 82 }; | 86 }; |
| 83 | 87 |
| 84 } // namespace extensions | 88 } // namespace extensions |
| 85 | 89 |
| 86 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ | 90 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ |
| OLD | NEW |