| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 415 } |
| 416 return Run(); | 416 return Run(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 bool ExtensionFunction::ShouldSkipQuotaLimiting() const { | 419 bool ExtensionFunction::ShouldSkipQuotaLimiting() const { |
| 420 return false; | 420 return false; |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool ExtensionFunction::HasOptionalArgument(size_t index) { | 423 bool ExtensionFunction::HasOptionalArgument(size_t index) { |
| 424 base::Value* value; | 424 base::Value* value; |
| 425 return args_->Get(index, &value) && !value->IsType(base::Value::TYPE_NULL); | 425 return args_->Get(index, &value) && !value->IsType(base::Value::Type::NONE); |
| 426 } | 426 } |
| 427 | 427 |
| 428 void ExtensionFunction::SendResponseImpl(bool success) { | 428 void ExtensionFunction::SendResponseImpl(bool success) { |
| 429 DCHECK(!response_callback_.is_null()); | 429 DCHECK(!response_callback_.is_null()); |
| 430 DCHECK(!did_respond_) << name_; | 430 DCHECK(!did_respond_) << name_; |
| 431 did_respond_ = true; | 431 did_respond_ = true; |
| 432 | 432 |
| 433 ResponseType response = success ? SUCCEEDED : FAILED; | 433 ResponseType response = success ? SUCCEEDED : FAILED; |
| 434 if (bad_message_) { | 434 if (bad_message_) { |
| 435 response = BAD_MESSAGE; | 435 response = BAD_MESSAGE; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 void AsyncExtensionFunction::SendResponse(bool success) { | 616 void AsyncExtensionFunction::SendResponse(bool success) { |
| 617 ResponseValue response; | 617 ResponseValue response; |
| 618 if (success) { | 618 if (success) { |
| 619 response = ArgumentList(std::move(results_)); | 619 response = ArgumentList(std::move(results_)); |
| 620 } else { | 620 } else { |
| 621 response = results_ ? ErrorWithArguments(std::move(results_), error_) | 621 response = results_ ? ErrorWithArguments(std::move(results_), error_) |
| 622 : Error(error_); | 622 : Error(error_); |
| 623 } | 623 } |
| 624 Respond(std::move(response)); | 624 Respond(std::move(response)); |
| 625 } | 625 } |
| OLD | NEW |