| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return NULL; | 283 return NULL; |
| 284 } | 284 } |
| 285 | 285 |
| 286 IOThreadExtensionFunction* ExtensionFunction::AsIOThreadExtensionFunction() { | 286 IOThreadExtensionFunction* ExtensionFunction::AsIOThreadExtensionFunction() { |
| 287 return NULL; | 287 return NULL; |
| 288 } | 288 } |
| 289 | 289 |
| 290 bool ExtensionFunction::HasPermission() { | 290 bool ExtensionFunction::HasPermission() { |
| 291 Feature::Availability availability = | 291 Feature::Availability availability = |
| 292 ExtensionAPI::GetSharedInstance()->IsAvailable( | 292 ExtensionAPI::GetSharedInstance()->IsAvailable( |
| 293 name_, extension_.get(), source_context_type_, source_url()); | 293 name_, extension_.get(), source_context_type_, source_url(), |
| 294 extensions::CheckAliasStatus::ALLOWED); |
| 294 return availability.is_available(); | 295 return availability.is_available(); |
| 295 } | 296 } |
| 296 | 297 |
| 297 void ExtensionFunction::OnQuotaExceeded(const std::string& violation_error) { | 298 void ExtensionFunction::OnQuotaExceeded(const std::string& violation_error) { |
| 298 error_ = violation_error; | 299 error_ = violation_error; |
| 299 SendResponseImpl(false); | 300 SendResponseImpl(false); |
| 300 } | 301 } |
| 301 | 302 |
| 302 void ExtensionFunction::SetArgs(const base::ListValue* args) { | 303 void ExtensionFunction::SetArgs(const base::ListValue* args) { |
| 303 DCHECK(!args_.get()); // Should only be called once. | 304 DCHECK(!args_.get()); // Should only be called once. |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 void AsyncExtensionFunction::SendResponse(bool success) { | 617 void AsyncExtensionFunction::SendResponse(bool success) { |
| 617 ResponseValue response; | 618 ResponseValue response; |
| 618 if (success) { | 619 if (success) { |
| 619 response = ArgumentList(std::move(results_)); | 620 response = ArgumentList(std::move(results_)); |
| 620 } else { | 621 } else { |
| 621 response = results_ ? ErrorWithArguments(std::move(results_), error_) | 622 response = results_ ? ErrorWithArguments(std::move(results_), error_) |
| 622 : Error(error_); | 623 : Error(error_); |
| 623 } | 624 } |
| 624 Respond(std::move(response)); | 625 Respond(std::move(response)); |
| 625 } | 626 } |
| OLD | NEW |