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 #include "chrome/browser/extensions/api/execute_code_function.h" | 5 #include "chrome/browser/extensions/api/execute_code_function.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
8 #include "chrome/browser/extensions/image_loader.h" | 8 #include "chrome/browser/extensions/image_loader.h" |
9 #include "chrome/browser/extensions/script_executor.h" | 9 #include "chrome/browser/extensions/script_executor.h" |
10 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 10 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 has_callback() ? ScriptExecutor::JSON_SERIALIZED_RESULT | 155 has_callback() ? ScriptExecutor::JSON_SERIALIZED_RESULT |
156 : ScriptExecutor::NO_RESULT, | 156 : ScriptExecutor::NO_RESULT, |
157 base::Bind(&ExecuteCodeFunction::OnExecuteCodeFinished, this)); | 157 base::Bind(&ExecuteCodeFunction::OnExecuteCodeFinished, this)); |
158 return true; | 158 return true; |
159 } | 159 } |
160 | 160 |
161 bool ExecuteCodeFunction::HasPermission() { | 161 bool ExecuteCodeFunction::HasPermission() { |
162 return true; | 162 return true; |
163 } | 163 } |
164 | 164 |
165 bool ExecuteCodeFunction::RunImpl() { | 165 bool ExecuteCodeFunction::RunAsync() { |
166 EXTENSION_FUNCTION_VALIDATE(Init()); | 166 EXTENSION_FUNCTION_VALIDATE(Init()); |
167 | 167 |
168 if (!details_->code.get() && !details_->file.get()) { | 168 if (!details_->code.get() && !details_->file.get()) { |
169 error_ = keys::kNoCodeOrFileToExecuteError; | 169 error_ = keys::kNoCodeOrFileToExecuteError; |
170 return false; | 170 return false; |
171 } | 171 } |
172 if (details_->code.get() && details_->file.get()) { | 172 if (details_->code.get() && details_->file.get()) { |
173 error_ = keys::kMoreThanOneValuesError; | 173 error_ = keys::kMoreThanOneValuesError; |
174 return false; | 174 return false; |
175 } | 175 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 int32 on_page_id, | 209 int32 on_page_id, |
210 const GURL& on_url, | 210 const GURL& on_url, |
211 const base::ListValue& result) { | 211 const base::ListValue& result) { |
212 if (!error.empty()) | 212 if (!error.empty()) |
213 SetError(error); | 213 SetError(error); |
214 | 214 |
215 SendResponse(error.empty()); | 215 SendResponse(error.empty()); |
216 } | 216 } |
217 | 217 |
218 } // namespace extensions | 218 } // namespace extensions |
OLD | NEW |