Chromium Code Reviews| Index: extensions/browser/api/networking_private/networking_private_api.cc |
| diff --git a/extensions/browser/api/networking_private/networking_private_api.cc b/extensions/browser/api/networking_private/networking_private_api.cc |
| index d8f30697ba3ad6182cd15781b0ece92e1d05b914..b31d52aa8f7e81b5bb1e538e744c2661aa82dd9f 100644 |
| --- a/extensions/browser/api/networking_private/networking_private_api.cc |
| +++ b/extensions/browser/api/networking_private/networking_private_api.cc |
| @@ -51,7 +51,8 @@ NetworkingPrivateGetPropertiesFunction:: |
| ~NetworkingPrivateGetPropertiesFunction() { |
| } |
| -bool NetworkingPrivateGetPropertiesFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateGetPropertiesFunction::Run() { |
| std::unique_ptr<private_api::GetProperties::Params> params = |
| private_api::GetProperties::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -61,18 +62,16 @@ bool NetworkingPrivateGetPropertiesFunction::RunAsync() { |
| params->network_guid, |
| base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this), |
| base::Bind(&NetworkingPrivateGetPropertiesFunction::Failure, this)); |
|
Devlin
2017/01/06 15:51:06
Here, too, these can conditionally fire synchronou
lazyboy
2017/01/19 03:47:59
Done.
|
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetPropertiesFunction::Success( |
| std::unique_ptr<base::DictionaryValue> result) { |
| - SetResult(std::move(result)); |
| - SendResponse(true); |
| + Respond(OneArgument(std::move(result))); |
| } |
| void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -82,7 +81,8 @@ NetworkingPrivateGetManagedPropertiesFunction:: |
| ~NetworkingPrivateGetManagedPropertiesFunction() { |
| } |
| -bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateGetManagedPropertiesFunction::Run() { |
| std::unique_ptr<private_api::GetManagedProperties::Params> params = |
| private_api::GetManagedProperties::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -94,19 +94,17 @@ bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetManagedPropertiesFunction::Success( |
| std::unique_ptr<base::DictionaryValue> result) { |
| - SetResult(std::move(result)); |
| - SendResponse(true); |
| + Respond(OneArgument(std::move(result))); |
| } |
| void NetworkingPrivateGetManagedPropertiesFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -115,7 +113,7 @@ void NetworkingPrivateGetManagedPropertiesFunction::Failure( |
| NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() { |
| } |
| -bool NetworkingPrivateGetStateFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction NetworkingPrivateGetStateFunction::Run() { |
| std::unique_ptr<private_api::GetState::Params> params = |
| private_api::GetState::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -124,18 +122,16 @@ bool NetworkingPrivateGetStateFunction::RunAsync() { |
| ->GetState(params->network_guid, |
| base::Bind(&NetworkingPrivateGetStateFunction::Success, this), |
| base::Bind(&NetworkingPrivateGetStateFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetStateFunction::Success( |
| std::unique_ptr<base::DictionaryValue> result) { |
| - SetResult(std::move(result)); |
| - SendResponse(true); |
| + Respond(OneArgument(std::move(result))); |
| } |
| void NetworkingPrivateGetStateFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -145,7 +141,8 @@ NetworkingPrivateSetPropertiesFunction:: |
| ~NetworkingPrivateSetPropertiesFunction() { |
| } |
| -bool NetworkingPrivateSetPropertiesFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateSetPropertiesFunction::Run() { |
| std::unique_ptr<private_api::SetProperties::Params> params = |
| private_api::SetProperties::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -158,16 +155,15 @@ bool NetworkingPrivateSetPropertiesFunction::RunAsync() { |
| params->network_guid, std::move(properties_dict), |
| base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this), |
| base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateSetPropertiesFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -177,7 +173,8 @@ NetworkingPrivateCreateNetworkFunction:: |
| ~NetworkingPrivateCreateNetworkFunction() { |
| } |
| -bool NetworkingPrivateCreateNetworkFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateCreateNetworkFunction::Run() { |
| std::unique_ptr<private_api::CreateNetwork::Params> params = |
| private_api::CreateNetwork::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -190,17 +187,15 @@ bool NetworkingPrivateCreateNetworkFunction::RunAsync() { |
| params->shared, std::move(properties_dict), |
| base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this), |
| base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) { |
| - results_ = private_api::CreateNetwork::Results::Create(guid); |
| - SendResponse(true); |
| + Respond(ArgumentList(private_api::CreateNetwork::Results::Create(guid))); |
| } |
| void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -210,7 +205,8 @@ NetworkingPrivateForgetNetworkFunction:: |
| ~NetworkingPrivateForgetNetworkFunction() { |
| } |
| -bool NetworkingPrivateForgetNetworkFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateForgetNetworkFunction::Run() { |
| std::unique_ptr<private_api::ForgetNetwork::Params> params = |
| private_api::ForgetNetwork::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -220,16 +216,15 @@ bool NetworkingPrivateForgetNetworkFunction::RunAsync() { |
| params->network_guid, |
| base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this), |
| base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateForgetNetworkFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -238,7 +233,7 @@ void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) { |
| NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() { |
| } |
| -bool NetworkingPrivateGetNetworksFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction NetworkingPrivateGetNetworksFunction::Run() { |
| std::unique_ptr<private_api::GetNetworks::Params> params = |
| private_api::GetNetworks::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -256,18 +251,16 @@ bool NetworkingPrivateGetNetworksFunction::RunAsync() { |
| network_type, configured_only, visible_only, limit, |
| base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this), |
| base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetNetworksFunction::Success( |
| std::unique_ptr<base::ListValue> network_list) { |
| - SetResult(std::move(network_list)); |
| - SendResponse(true); |
| + return Respond(ArgumentList(std::move(network_list))); |
| } |
| void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -277,7 +270,8 @@ NetworkingPrivateGetVisibleNetworksFunction:: |
| ~NetworkingPrivateGetVisibleNetworksFunction() { |
| } |
| -bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateGetVisibleNetworksFunction::Run() { |
| std::unique_ptr<private_api::GetVisibleNetworks::Params> params = |
| private_api::GetVisibleNetworks::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -293,19 +287,17 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetVisibleNetworksFunction::Success( |
| std::unique_ptr<base::ListValue> network_properties_list) { |
| - SetResult(std::move(network_properties_list)); |
| - SendResponse(true); |
| + Respond(ArgumentList(std::move(network_properties_list))); |
| } |
| void NetworkingPrivateGetVisibleNetworksFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -426,7 +418,7 @@ NetworkingPrivateStartConnectFunction:: |
| ~NetworkingPrivateStartConnectFunction() { |
| } |
| -bool NetworkingPrivateStartConnectFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction NetworkingPrivateStartConnectFunction::Run() { |
| std::unique_ptr<private_api::StartConnect::Params> params = |
| private_api::StartConnect::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -436,16 +428,15 @@ bool NetworkingPrivateStartConnectFunction::RunAsync() { |
| params->network_guid, |
| base::Bind(&NetworkingPrivateStartConnectFunction::Success, this), |
| base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateStartConnectFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -455,7 +446,8 @@ NetworkingPrivateStartDisconnectFunction:: |
| ~NetworkingPrivateStartDisconnectFunction() { |
| } |
| -bool NetworkingPrivateStartDisconnectFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateStartDisconnectFunction::Run() { |
| std::unique_ptr<private_api::StartDisconnect::Params> params = |
| private_api::StartDisconnect::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -465,17 +457,16 @@ bool NetworkingPrivateStartDisconnectFunction::RunAsync() { |
| params->network_guid, |
| base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this), |
| base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateStartDisconnectFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateStartDisconnectFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -485,7 +476,8 @@ NetworkingPrivateStartActivateFunction:: |
| ~NetworkingPrivateStartActivateFunction() { |
| } |
| -bool NetworkingPrivateStartActivateFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateStartActivateFunction::Run() { |
| std::unique_ptr<private_api::StartActivate::Params> params = |
| private_api::StartActivate::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -495,16 +487,15 @@ bool NetworkingPrivateStartActivateFunction::RunAsync() { |
| params->network_guid, params->carrier ? *params->carrier : "", |
| base::Bind(&NetworkingPrivateStartActivateFunction::Success, this), |
| base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateStartActivateFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateStartActivateFunction::Failure(const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -514,7 +505,8 @@ NetworkingPrivateVerifyDestinationFunction:: |
| ~NetworkingPrivateVerifyDestinationFunction() { |
| } |
| -bool NetworkingPrivateVerifyDestinationFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateVerifyDestinationFunction::Run() { |
| std::unique_ptr<private_api::VerifyDestination::Params> params = |
| private_api::VerifyDestination::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -526,18 +518,17 @@ bool NetworkingPrivateVerifyDestinationFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateVerifyDestinationFunction::Success(bool result) { |
| - results_ = private_api::VerifyDestination::Results::Create(result); |
| - SendResponse(true); |
| + Respond( |
| + ArgumentList(private_api::VerifyDestination::Results::Create(result))); |
| } |
| void NetworkingPrivateVerifyDestinationFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -547,7 +538,8 @@ NetworkingPrivateVerifyAndEncryptCredentialsFunction:: |
| ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() { |
| } |
| -bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateVerifyAndEncryptCredentialsFunction::Run() { |
| std::unique_ptr<private_api::VerifyAndEncryptCredentials::Params> params = |
| private_api::VerifyAndEncryptCredentials::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -561,19 +553,18 @@ bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() { |
| base::Bind( |
| &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success( |
| const std::string& result) { |
| - results_ = private_api::VerifyAndEncryptCredentials::Results::Create(result); |
| - SendResponse(true); |
| + Respond(ArgumentList( |
| + private_api::VerifyAndEncryptCredentials::Results::Create(result))); |
| } |
| void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -583,7 +574,8 @@ NetworkingPrivateVerifyAndEncryptDataFunction:: |
| ~NetworkingPrivateVerifyAndEncryptDataFunction() { |
| } |
| -bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateVerifyAndEncryptDataFunction::Run() { |
| std::unique_ptr<private_api::VerifyAndEncryptData::Params> params = |
| private_api::VerifyAndEncryptData::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -595,19 +587,18 @@ bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateVerifyAndEncryptDataFunction::Success( |
| const std::string& result) { |
| - results_ = private_api::VerifyAndEncryptData::Results::Create(result); |
| - SendResponse(true); |
| + Respond( |
| + ArgumentList(private_api::VerifyAndEncryptData::Results::Create(result))); |
| } |
| void NetworkingPrivateVerifyAndEncryptDataFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -617,7 +608,8 @@ NetworkingPrivateSetWifiTDLSEnabledStateFunction:: |
| ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() { |
| } |
| -bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateSetWifiTDLSEnabledStateFunction::Run() { |
| std::unique_ptr<private_api::SetWifiTDLSEnabledState::Params> params = |
| private_api::SetWifiTDLSEnabledState::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -630,19 +622,18 @@ bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() { |
| base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success( |
| const std::string& result) { |
| - results_ = private_api::SetWifiTDLSEnabledState::Results::Create(result); |
| - SendResponse(true); |
| + Respond(ArgumentList( |
| + private_api::SetWifiTDLSEnabledState::Results::Create(result))); |
| } |
| void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -652,7 +643,8 @@ NetworkingPrivateGetWifiTDLSStatusFunction:: |
| ~NetworkingPrivateGetWifiTDLSStatusFunction() { |
| } |
| -bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateGetWifiTDLSStatusFunction::Run() { |
| std::unique_ptr<private_api::GetWifiTDLSStatus::Params> params = |
| private_api::GetWifiTDLSStatus::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -665,19 +657,18 @@ bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() { |
| base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetWifiTDLSStatusFunction::Success( |
| const std::string& result) { |
| - results_ = private_api::GetWifiTDLSStatus::Results::Create(result); |
| - SendResponse(true); |
| + Respond( |
| + ArgumentList(private_api::GetWifiTDLSStatus::Results::Create(result))); |
| } |
| void NetworkingPrivateGetWifiTDLSStatusFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -687,7 +678,8 @@ NetworkingPrivateGetCaptivePortalStatusFunction:: |
| ~NetworkingPrivateGetCaptivePortalStatusFunction() { |
| } |
| -bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateGetCaptivePortalStatusFunction::Run() { |
| std::unique_ptr<private_api::GetCaptivePortalStatus::Params> params = |
| private_api::GetCaptivePortalStatus::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -699,20 +691,18 @@ bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateGetCaptivePortalStatusFunction::Success( |
| const std::string& result) { |
| - results_ = private_api::GetCaptivePortalStatus::Results::Create( |
| - private_api::ParseCaptivePortalStatus(result)); |
| - SendResponse(true); |
| + Respond(ArgumentList(private_api::GetCaptivePortalStatus::Results::Create( |
| + private_api::ParseCaptivePortalStatus(result)))); |
| } |
| void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -721,7 +711,8 @@ void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( |
| NetworkingPrivateUnlockCellularSimFunction:: |
| ~NetworkingPrivateUnlockCellularSimFunction() {} |
| -bool NetworkingPrivateUnlockCellularSimFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateUnlockCellularSimFunction::Run() { |
| std::unique_ptr<private_api::UnlockCellularSim::Params> params = |
| private_api::UnlockCellularSim::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -733,17 +724,16 @@ bool NetworkingPrivateUnlockCellularSimFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateUnlockCellularSimFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateUnlockCellularSimFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -752,7 +742,8 @@ void NetworkingPrivateUnlockCellularSimFunction::Failure( |
| NetworkingPrivateSetCellularSimStateFunction:: |
| ~NetworkingPrivateSetCellularSimStateFunction() {} |
| -bool NetworkingPrivateSetCellularSimStateFunction::RunAsync() { |
| +ExtensionFunction::ResponseAction |
| +NetworkingPrivateSetCellularSimStateFunction::Run() { |
| std::unique_ptr<private_api::SetCellularSimState::Params> params = |
| private_api::SetCellularSimState::Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(params); |
| @@ -766,17 +757,16 @@ bool NetworkingPrivateSetCellularSimStateFunction::RunAsync() { |
| this), |
| base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Failure, |
| this)); |
| - return true; |
| + return RespondLater(); |
| } |
| void NetworkingPrivateSetCellularSimStateFunction::Success() { |
| - SendResponse(true); |
| + Respond(NoArguments()); |
| } |
| void NetworkingPrivateSetCellularSimStateFunction::Failure( |
| const std::string& error) { |
| - error_ = error; |
| - SendResponse(false); |
| + Respond(Error(error)); |
| } |
| } // namespace extensions |