| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/browser/extension_function.h" | 5 #include "extensions/browser/extension_function.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 305 } |
| 306 | 306 |
| 307 const base::ListValue* ExtensionFunction::GetResultList() const { | 307 const base::ListValue* ExtensionFunction::GetResultList() const { |
| 308 return results_.get(); | 308 return results_.get(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 const std::string& ExtensionFunction::GetError() const { | 311 const std::string& ExtensionFunction::GetError() const { |
| 312 return error_; | 312 return error_; |
| 313 } | 313 } |
| 314 | 314 |
| 315 void ExtensionFunction::SetError(const std::string& error) { | |
| 316 error_ = error; | |
| 317 } | |
| 318 | |
| 319 bool ExtensionFunction::user_gesture() const { | 315 bool ExtensionFunction::user_gesture() const { |
| 320 return user_gesture_ || UserGestureForTests::GetInstance()->HaveGesture(); | 316 return user_gesture_ || UserGestureForTests::GetInstance()->HaveGesture(); |
| 321 } | 317 } |
| 322 | 318 |
| 323 ExtensionFunction::ResponseValue ExtensionFunction::NoArguments() { | 319 ExtensionFunction::ResponseValue ExtensionFunction::NoArguments() { |
| 324 return ResponseValue( | 320 return ResponseValue( |
| 325 new ArgumentListResponseValue(this, base::MakeUnique<base::ListValue>())); | 321 new ArgumentListResponseValue(this, base::MakeUnique<base::ListValue>())); |
| 326 } | 322 } |
| 327 | 323 |
| 328 ExtensionFunction::ResponseValue ExtensionFunction::OneArgument( | 324 ExtensionFunction::ResponseValue ExtensionFunction::OneArgument( |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 void AsyncExtensionFunction::SendResponse(bool success) { | 613 void AsyncExtensionFunction::SendResponse(bool success) { |
| 618 ResponseValue response; | 614 ResponseValue response; |
| 619 if (success) { | 615 if (success) { |
| 620 response = ArgumentList(std::move(results_)); | 616 response = ArgumentList(std::move(results_)); |
| 621 } else { | 617 } else { |
| 622 response = results_ ? ErrorWithArguments(std::move(results_), error_) | 618 response = results_ ? ErrorWithArguments(std::move(results_), error_) |
| 623 : Error(error_); | 619 : Error(error_); |
| 624 } | 620 } |
| 625 Respond(std::move(response)); | 621 Respond(std::move(response)); |
| 626 } | 622 } |
| OLD | NEW |