| Index: extensions/browser/api/execute_code_function.cc
|
| diff --git a/extensions/browser/api/execute_code_function.cc b/extensions/browser/api/execute_code_function.cc
|
| index aebf61f46b4dd9dcec948e8cfa5326fea796cef3..394d0dd5deec884a97350d817891956367b516ef 100644
|
| --- a/extensions/browser/api/execute_code_function.cc
|
| +++ b/extensions/browser/api/execute_code_function.cc
|
| @@ -41,6 +41,13 @@ ExecuteCodeFunction::ExecuteCodeFunction() {
|
| ExecuteCodeFunction::~ExecuteCodeFunction() {
|
| }
|
|
|
| +bool ExecuteCodeFunction::LoadFileForWebUI(
|
| + const std::string& file_src,
|
| + const WebUILoadFileCallback& callback) {
|
| + callback.Run(false, std::string());
|
| + return false;
|
| +}
|
| +
|
| void ExecuteCodeFunction::DidLoadFile(bool success, const std::string& data) {
|
| if (!success || !details_->file) {
|
| DidLoadAndLocalizeFile(success, data);
|
| @@ -124,6 +131,18 @@ void ExecuteCodeFunction::DidLoadAndLocalizeFile(bool success,
|
| }
|
| }
|
|
|
| +void ExecuteCodeFunction::DidLoadFileForWebUI(bool success,
|
| + const std::string& data) {
|
| + if (success) {
|
| + if (!base::IsStringUTF8(data))
|
| + SendResponse(false);
|
| + else if (!Execute(data))
|
| + SendResponse(false);
|
| + } else {
|
| + SendResponse(false);
|
| + }
|
| +}
|
| +
|
| bool ExecuteCodeFunction::Execute(const std::string& code_string) {
|
| ScriptExecutor* executor = GetScriptExecutor();
|
| if (!executor)
|
| @@ -205,8 +224,18 @@ bool ExecuteCodeFunction::RunAsync() {
|
| if (!details_->file.get())
|
| return false;
|
|
|
| - if (!extension())
|
| - return false;
|
| + if (!extension()) {
|
| + bool is_success = false;
|
| + is_success = LoadFileForWebUI(
|
| + *details_->file,
|
| + base::Bind(&ExecuteCodeFunction::DidLoadFileForWebUI, this));
|
| + if (!is_success) {
|
| + SendResponse(false);
|
| + return false;
|
| + }
|
| + // Will finish asynchronously.
|
| + return true;
|
| + }
|
|
|
| resource_ = extension()->GetResource(*details_->file);
|
|
|
|
|