Chromium Code Reviews| 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 "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 std::unique_ptr<api::extension_types::InjectDetails> details_; | 77 std::unique_ptr<api::extension_types::InjectDetails> details_; |
| 78 base::Optional<InitResult> init_result_; | 78 base::Optional<InitResult> init_result_; |
| 79 // Set iff |init_result_| == FAILURE, holds the error string. | 79 // Set iff |init_result_| == FAILURE, holds the error string. |
| 80 base::Optional<std::string> init_error_; | 80 base::Optional<std::string> init_error_; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // Retrieves the file url for the given |extension_path| and optionally | 83 // Retrieves the file url for the given |extension_path| and optionally |
| 84 // localizes |data|. | 84 // localizes |data|. |
| 85 // Localization depends on whether |might_require_localization| was specified. | 85 // Localization depends on whether |might_require_localization| was specified. |
| 86 // Only CSS file content needs to be localized. | 86 // Only CSS file content needs to be localized. |
| 87 void GetFileURLAndMaybeLocalizeOnFileThread( | 87 void GetFileURLAndMaybeLocalizeOnBackgroundThread( |
|
karandeepb
2017/07/13 01:47:48
Why "Background"?
Maybe GetFileURLAndMaybeLocali
Devlin
2017/07/13 18:35:09
"Background" is just the idea of a background thre
karandeepb
2017/07/13 20:18:48
Background seems to tell me that this is run on a
Devlin
2017/07/14 00:52:03
Done.
| |
| 88 const std::string& extension_id, | 88 const std::string& extension_id, |
| 89 const base::FilePath& extension_path, | 89 const base::FilePath& extension_path, |
| 90 const std::string& extension_default_locale, | 90 const std::string& extension_default_locale, |
| 91 bool might_require_localization, | 91 bool might_require_localization, |
| 92 std::string* data); | 92 std::string* data); |
| 93 | 93 |
| 94 // Retrieves the file url for the given |extension_path| and optionally | 94 // Retrieves the file url for the given |extension_path| and optionally |
| 95 // localizes |data|. | 95 // localizes |data|. |
| 96 // Similar to GetFileURLAndMaybeLocalizeOnFileThread, but only applies to | 96 // Similar to GetFileURLAndMaybeLocalizeOnBackgroundThread, but only applies |
| 97 // component extension resource. | 97 // to component extension resource. |
| 98 void GetFileURLAndLocalizeComponentResourceOnFileThread( | 98 std::unique_ptr<std::string> |
| 99 GetFileURLAndLocalizeComponentResourceOnBackgroundThread( | |
| 99 std::unique_ptr<std::string> data, | 100 std::unique_ptr<std::string> data, |
| 100 const std::string& extension_id, | 101 const std::string& extension_id, |
| 101 const base::FilePath& extension_path, | 102 const base::FilePath& extension_path, |
| 102 const std::string& extension_default_locale, | 103 const std::string& extension_default_locale, |
| 103 bool might_require_localization); | 104 bool might_require_localization); |
| 104 | 105 |
| 105 // Run in UI thread. Code string contains the code to be executed. Returns | 106 // Run in UI thread. Code string contains the code to be executed. Returns |
| 106 // true on success. If true is returned, this does an AddRef. | 107 // true on success. If true is returned, this does an AddRef. |
| 107 bool Execute(const std::string& code_string); | 108 bool Execute(const std::string& code_string); |
| 108 | 109 |
| 109 // Contains extension resource built from path of file which is | 110 // Contains extension resource built from path of file which is |
| 110 // specified in JSON arguments. | 111 // specified in JSON arguments. |
| 111 ExtensionResource resource_; | 112 ExtensionResource resource_; |
| 112 | 113 |
| 113 // The URL of the file being injected into the page. | 114 // The URL of the file being injected into the page. |
| 114 GURL file_url_; | 115 GURL file_url_; |
| 115 | 116 |
| 116 // The ID of the injection host. | 117 // The ID of the injection host. |
| 117 HostID host_id_; | 118 HostID host_id_; |
| 118 | 119 |
| 119 DISALLOW_COPY_AND_ASSIGN(ExecuteCodeFunction); | 120 DISALLOW_COPY_AND_ASSIGN(ExecuteCodeFunction); |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 } // namespace extensions | 123 } // namespace extensions |
| 123 | 124 |
| 124 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ | 125 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ |
| OLD | NEW |