Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: extensions/browser/api/networking_private/networking_private_api.cc

Issue 2612873004: Remove some usages of AsyncExtensionFunction::results_. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/api/networking_private/networking_private_api.h" 5 #include "extensions/browser/api/networking_private/networking_private_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 } // namespace networking_private 45 } // namespace networking_private
46 46
47 //////////////////////////////////////////////////////////////////////////////// 47 ////////////////////////////////////////////////////////////////////////////////
48 // NetworkingPrivateGetPropertiesFunction 48 // NetworkingPrivateGetPropertiesFunction
49 49
50 NetworkingPrivateGetPropertiesFunction:: 50 NetworkingPrivateGetPropertiesFunction::
51 ~NetworkingPrivateGetPropertiesFunction() { 51 ~NetworkingPrivateGetPropertiesFunction() {
52 } 52 }
53 53
54 bool NetworkingPrivateGetPropertiesFunction::RunAsync() { 54 ExtensionFunction::ResponseAction
55 NetworkingPrivateGetPropertiesFunction::Run() {
55 std::unique_ptr<private_api::GetProperties::Params> params = 56 std::unique_ptr<private_api::GetProperties::Params> params =
56 private_api::GetProperties::Params::Create(*args_); 57 private_api::GetProperties::Params::Create(*args_);
57 EXTENSION_FUNCTION_VALIDATE(params); 58 EXTENSION_FUNCTION_VALIDATE(params);
58 59
59 GetDelegate(browser_context()) 60 GetDelegate(browser_context())
60 ->GetProperties( 61 ->GetProperties(
61 params->network_guid, 62 params->network_guid,
62 base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this), 63 base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this),
63 base::Bind(&NetworkingPrivateGetPropertiesFunction::Failure, this)); 64 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.
64 return true; 65 return RespondLater();
65 } 66 }
66 67
67 void NetworkingPrivateGetPropertiesFunction::Success( 68 void NetworkingPrivateGetPropertiesFunction::Success(
68 std::unique_ptr<base::DictionaryValue> result) { 69 std::unique_ptr<base::DictionaryValue> result) {
69 SetResult(std::move(result)); 70 Respond(OneArgument(std::move(result)));
70 SendResponse(true);
71 } 71 }
72 72
73 void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) { 73 void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) {
74 error_ = error; 74 Respond(Error(error));
75 SendResponse(false);
76 } 75 }
77 76
78 //////////////////////////////////////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////////////////
79 // NetworkingPrivateGetManagedPropertiesFunction 78 // NetworkingPrivateGetManagedPropertiesFunction
80 79
81 NetworkingPrivateGetManagedPropertiesFunction:: 80 NetworkingPrivateGetManagedPropertiesFunction::
82 ~NetworkingPrivateGetManagedPropertiesFunction() { 81 ~NetworkingPrivateGetManagedPropertiesFunction() {
83 } 82 }
84 83
85 bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() { 84 ExtensionFunction::ResponseAction
85 NetworkingPrivateGetManagedPropertiesFunction::Run() {
86 std::unique_ptr<private_api::GetManagedProperties::Params> params = 86 std::unique_ptr<private_api::GetManagedProperties::Params> params =
87 private_api::GetManagedProperties::Params::Create(*args_); 87 private_api::GetManagedProperties::Params::Create(*args_);
88 EXTENSION_FUNCTION_VALIDATE(params); 88 EXTENSION_FUNCTION_VALIDATE(params);
89 89
90 GetDelegate(browser_context()) 90 GetDelegate(browser_context())
91 ->GetManagedProperties( 91 ->GetManagedProperties(
92 params->network_guid, 92 params->network_guid,
93 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, 93 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success,
94 this), 94 this),
95 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, 95 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure,
96 this)); 96 this));
97 return true; 97 return RespondLater();
98 } 98 }
99 99
100 void NetworkingPrivateGetManagedPropertiesFunction::Success( 100 void NetworkingPrivateGetManagedPropertiesFunction::Success(
101 std::unique_ptr<base::DictionaryValue> result) { 101 std::unique_ptr<base::DictionaryValue> result) {
102 SetResult(std::move(result)); 102 Respond(OneArgument(std::move(result)));
103 SendResponse(true);
104 } 103 }
105 104
106 void NetworkingPrivateGetManagedPropertiesFunction::Failure( 105 void NetworkingPrivateGetManagedPropertiesFunction::Failure(
107 const std::string& error) { 106 const std::string& error) {
108 error_ = error; 107 Respond(Error(error));
109 SendResponse(false);
110 } 108 }
111 109
112 //////////////////////////////////////////////////////////////////////////////// 110 ////////////////////////////////////////////////////////////////////////////////
113 // NetworkingPrivateGetStateFunction 111 // NetworkingPrivateGetStateFunction
114 112
115 NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() { 113 NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() {
116 } 114 }
117 115
118 bool NetworkingPrivateGetStateFunction::RunAsync() { 116 ExtensionFunction::ResponseAction NetworkingPrivateGetStateFunction::Run() {
119 std::unique_ptr<private_api::GetState::Params> params = 117 std::unique_ptr<private_api::GetState::Params> params =
120 private_api::GetState::Params::Create(*args_); 118 private_api::GetState::Params::Create(*args_);
121 EXTENSION_FUNCTION_VALIDATE(params); 119 EXTENSION_FUNCTION_VALIDATE(params);
122 120
123 GetDelegate(browser_context()) 121 GetDelegate(browser_context())
124 ->GetState(params->network_guid, 122 ->GetState(params->network_guid,
125 base::Bind(&NetworkingPrivateGetStateFunction::Success, this), 123 base::Bind(&NetworkingPrivateGetStateFunction::Success, this),
126 base::Bind(&NetworkingPrivateGetStateFunction::Failure, this)); 124 base::Bind(&NetworkingPrivateGetStateFunction::Failure, this));
127 return true; 125 return RespondLater();
128 } 126 }
129 127
130 void NetworkingPrivateGetStateFunction::Success( 128 void NetworkingPrivateGetStateFunction::Success(
131 std::unique_ptr<base::DictionaryValue> result) { 129 std::unique_ptr<base::DictionaryValue> result) {
132 SetResult(std::move(result)); 130 Respond(OneArgument(std::move(result)));
133 SendResponse(true);
134 } 131 }
135 132
136 void NetworkingPrivateGetStateFunction::Failure(const std::string& error) { 133 void NetworkingPrivateGetStateFunction::Failure(const std::string& error) {
137 error_ = error; 134 Respond(Error(error));
138 SendResponse(false);
139 } 135 }
140 136
141 //////////////////////////////////////////////////////////////////////////////// 137 ////////////////////////////////////////////////////////////////////////////////
142 // NetworkingPrivateSetPropertiesFunction 138 // NetworkingPrivateSetPropertiesFunction
143 139
144 NetworkingPrivateSetPropertiesFunction:: 140 NetworkingPrivateSetPropertiesFunction::
145 ~NetworkingPrivateSetPropertiesFunction() { 141 ~NetworkingPrivateSetPropertiesFunction() {
146 } 142 }
147 143
148 bool NetworkingPrivateSetPropertiesFunction::RunAsync() { 144 ExtensionFunction::ResponseAction
145 NetworkingPrivateSetPropertiesFunction::Run() {
149 std::unique_ptr<private_api::SetProperties::Params> params = 146 std::unique_ptr<private_api::SetProperties::Params> params =
150 private_api::SetProperties::Params::Create(*args_); 147 private_api::SetProperties::Params::Create(*args_);
151 EXTENSION_FUNCTION_VALIDATE(params); 148 EXTENSION_FUNCTION_VALIDATE(params);
152 149
153 std::unique_ptr<base::DictionaryValue> properties_dict( 150 std::unique_ptr<base::DictionaryValue> properties_dict(
154 params->properties.ToValue()); 151 params->properties.ToValue());
155 152
156 GetDelegate(browser_context()) 153 GetDelegate(browser_context())
157 ->SetProperties( 154 ->SetProperties(
158 params->network_guid, std::move(properties_dict), 155 params->network_guid, std::move(properties_dict),
159 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this), 156 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this),
160 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this)); 157 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this));
161 return true; 158 return RespondLater();
162 } 159 }
163 160
164 void NetworkingPrivateSetPropertiesFunction::Success() { 161 void NetworkingPrivateSetPropertiesFunction::Success() {
165 SendResponse(true); 162 Respond(NoArguments());
166 } 163 }
167 164
168 void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) { 165 void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) {
169 error_ = error; 166 Respond(Error(error));
170 SendResponse(false);
171 } 167 }
172 168
173 //////////////////////////////////////////////////////////////////////////////// 169 ////////////////////////////////////////////////////////////////////////////////
174 // NetworkingPrivateCreateNetworkFunction 170 // NetworkingPrivateCreateNetworkFunction
175 171
176 NetworkingPrivateCreateNetworkFunction:: 172 NetworkingPrivateCreateNetworkFunction::
177 ~NetworkingPrivateCreateNetworkFunction() { 173 ~NetworkingPrivateCreateNetworkFunction() {
178 } 174 }
179 175
180 bool NetworkingPrivateCreateNetworkFunction::RunAsync() { 176 ExtensionFunction::ResponseAction
177 NetworkingPrivateCreateNetworkFunction::Run() {
181 std::unique_ptr<private_api::CreateNetwork::Params> params = 178 std::unique_ptr<private_api::CreateNetwork::Params> params =
182 private_api::CreateNetwork::Params::Create(*args_); 179 private_api::CreateNetwork::Params::Create(*args_);
183 EXTENSION_FUNCTION_VALIDATE(params); 180 EXTENSION_FUNCTION_VALIDATE(params);
184 181
185 std::unique_ptr<base::DictionaryValue> properties_dict( 182 std::unique_ptr<base::DictionaryValue> properties_dict(
186 params->properties.ToValue()); 183 params->properties.ToValue());
187 184
188 GetDelegate(browser_context()) 185 GetDelegate(browser_context())
189 ->CreateNetwork( 186 ->CreateNetwork(
190 params->shared, std::move(properties_dict), 187 params->shared, std::move(properties_dict),
191 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this), 188 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this),
192 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this)); 189 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this));
193 return true; 190 return RespondLater();
194 } 191 }
195 192
196 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) { 193 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) {
197 results_ = private_api::CreateNetwork::Results::Create(guid); 194 Respond(ArgumentList(private_api::CreateNetwork::Results::Create(guid)));
198 SendResponse(true);
199 } 195 }
200 196
201 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) { 197 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) {
202 error_ = error; 198 Respond(Error(error));
203 SendResponse(false);
204 } 199 }
205 200
206 //////////////////////////////////////////////////////////////////////////////// 201 ////////////////////////////////////////////////////////////////////////////////
207 // NetworkingPrivateForgetNetworkFunction 202 // NetworkingPrivateForgetNetworkFunction
208 203
209 NetworkingPrivateForgetNetworkFunction:: 204 NetworkingPrivateForgetNetworkFunction::
210 ~NetworkingPrivateForgetNetworkFunction() { 205 ~NetworkingPrivateForgetNetworkFunction() {
211 } 206 }
212 207
213 bool NetworkingPrivateForgetNetworkFunction::RunAsync() { 208 ExtensionFunction::ResponseAction
209 NetworkingPrivateForgetNetworkFunction::Run() {
214 std::unique_ptr<private_api::ForgetNetwork::Params> params = 210 std::unique_ptr<private_api::ForgetNetwork::Params> params =
215 private_api::ForgetNetwork::Params::Create(*args_); 211 private_api::ForgetNetwork::Params::Create(*args_);
216 EXTENSION_FUNCTION_VALIDATE(params); 212 EXTENSION_FUNCTION_VALIDATE(params);
217 213
218 GetDelegate(browser_context()) 214 GetDelegate(browser_context())
219 ->ForgetNetwork( 215 ->ForgetNetwork(
220 params->network_guid, 216 params->network_guid,
221 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this), 217 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this),
222 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this)); 218 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this));
223 return true; 219 return RespondLater();
224 } 220 }
225 221
226 void NetworkingPrivateForgetNetworkFunction::Success() { 222 void NetworkingPrivateForgetNetworkFunction::Success() {
227 SendResponse(true); 223 Respond(NoArguments());
228 } 224 }
229 225
230 void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) { 226 void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) {
231 error_ = error; 227 Respond(Error(error));
232 SendResponse(false);
233 } 228 }
234 229
235 //////////////////////////////////////////////////////////////////////////////// 230 ////////////////////////////////////////////////////////////////////////////////
236 // NetworkingPrivateGetNetworksFunction 231 // NetworkingPrivateGetNetworksFunction
237 232
238 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() { 233 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() {
239 } 234 }
240 235
241 bool NetworkingPrivateGetNetworksFunction::RunAsync() { 236 ExtensionFunction::ResponseAction NetworkingPrivateGetNetworksFunction::Run() {
242 std::unique_ptr<private_api::GetNetworks::Params> params = 237 std::unique_ptr<private_api::GetNetworks::Params> params =
243 private_api::GetNetworks::Params::Create(*args_); 238 private_api::GetNetworks::Params::Create(*args_);
244 EXTENSION_FUNCTION_VALIDATE(params); 239 EXTENSION_FUNCTION_VALIDATE(params);
245 240
246 std::string network_type = private_api::ToString(params->filter.network_type); 241 std::string network_type = private_api::ToString(params->filter.network_type);
247 const bool configured_only = 242 const bool configured_only =
248 params->filter.configured ? *params->filter.configured : false; 243 params->filter.configured ? *params->filter.configured : false;
249 const bool visible_only = 244 const bool visible_only =
250 params->filter.visible ? *params->filter.visible : false; 245 params->filter.visible ? *params->filter.visible : false;
251 const int limit = 246 const int limit =
252 params->filter.limit ? *params->filter.limit : kDefaultNetworkListLimit; 247 params->filter.limit ? *params->filter.limit : kDefaultNetworkListLimit;
253 248
254 GetDelegate(browser_context()) 249 GetDelegate(browser_context())
255 ->GetNetworks( 250 ->GetNetworks(
256 network_type, configured_only, visible_only, limit, 251 network_type, configured_only, visible_only, limit,
257 base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this), 252 base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this),
258 base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this)); 253 base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this));
259 return true; 254 return RespondLater();
260 } 255 }
261 256
262 void NetworkingPrivateGetNetworksFunction::Success( 257 void NetworkingPrivateGetNetworksFunction::Success(
263 std::unique_ptr<base::ListValue> network_list) { 258 std::unique_ptr<base::ListValue> network_list) {
264 SetResult(std::move(network_list)); 259 return Respond(ArgumentList(std::move(network_list)));
265 SendResponse(true);
266 } 260 }
267 261
268 void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) { 262 void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) {
269 error_ = error; 263 Respond(Error(error));
270 SendResponse(false);
271 } 264 }
272 265
273 //////////////////////////////////////////////////////////////////////////////// 266 ////////////////////////////////////////////////////////////////////////////////
274 // NetworkingPrivateGetVisibleNetworksFunction 267 // NetworkingPrivateGetVisibleNetworksFunction
275 268
276 NetworkingPrivateGetVisibleNetworksFunction:: 269 NetworkingPrivateGetVisibleNetworksFunction::
277 ~NetworkingPrivateGetVisibleNetworksFunction() { 270 ~NetworkingPrivateGetVisibleNetworksFunction() {
278 } 271 }
279 272
280 bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() { 273 ExtensionFunction::ResponseAction
274 NetworkingPrivateGetVisibleNetworksFunction::Run() {
281 std::unique_ptr<private_api::GetVisibleNetworks::Params> params = 275 std::unique_ptr<private_api::GetVisibleNetworks::Params> params =
282 private_api::GetVisibleNetworks::Params::Create(*args_); 276 private_api::GetVisibleNetworks::Params::Create(*args_);
283 EXTENSION_FUNCTION_VALIDATE(params); 277 EXTENSION_FUNCTION_VALIDATE(params);
284 278
285 std::string network_type = private_api::ToString(params->network_type); 279 std::string network_type = private_api::ToString(params->network_type);
286 const bool configured_only = false; 280 const bool configured_only = false;
287 const bool visible_only = true; 281 const bool visible_only = true;
288 282
289 GetDelegate(browser_context()) 283 GetDelegate(browser_context())
290 ->GetNetworks( 284 ->GetNetworks(
291 network_type, configured_only, visible_only, kDefaultNetworkListLimit, 285 network_type, configured_only, visible_only, kDefaultNetworkListLimit,
292 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Success, 286 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Success,
293 this), 287 this),
294 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure, 288 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure,
295 this)); 289 this));
296 return true; 290 return RespondLater();
297 } 291 }
298 292
299 void NetworkingPrivateGetVisibleNetworksFunction::Success( 293 void NetworkingPrivateGetVisibleNetworksFunction::Success(
300 std::unique_ptr<base::ListValue> network_properties_list) { 294 std::unique_ptr<base::ListValue> network_properties_list) {
301 SetResult(std::move(network_properties_list)); 295 Respond(ArgumentList(std::move(network_properties_list)));
302 SendResponse(true);
303 } 296 }
304 297
305 void NetworkingPrivateGetVisibleNetworksFunction::Failure( 298 void NetworkingPrivateGetVisibleNetworksFunction::Failure(
306 const std::string& error) { 299 const std::string& error) {
307 error_ = error; 300 Respond(Error(error));
308 SendResponse(false);
309 } 301 }
310 302
311 //////////////////////////////////////////////////////////////////////////////// 303 ////////////////////////////////////////////////////////////////////////////////
312 // NetworkingPrivateGetEnabledNetworkTypesFunction 304 // NetworkingPrivateGetEnabledNetworkTypesFunction
313 305
314 NetworkingPrivateGetEnabledNetworkTypesFunction:: 306 NetworkingPrivateGetEnabledNetworkTypesFunction::
315 ~NetworkingPrivateGetEnabledNetworkTypesFunction() { 307 ~NetworkingPrivateGetEnabledNetworkTypesFunction() {
316 } 308 }
317 309
318 ExtensionFunction::ResponseAction 310 ExtensionFunction::ResponseAction
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 return RespondNow(NoArguments()); 411 return RespondNow(NoArguments());
420 } 412 }
421 413
422 //////////////////////////////////////////////////////////////////////////////// 414 ////////////////////////////////////////////////////////////////////////////////
423 // NetworkingPrivateStartConnectFunction 415 // NetworkingPrivateStartConnectFunction
424 416
425 NetworkingPrivateStartConnectFunction:: 417 NetworkingPrivateStartConnectFunction::
426 ~NetworkingPrivateStartConnectFunction() { 418 ~NetworkingPrivateStartConnectFunction() {
427 } 419 }
428 420
429 bool NetworkingPrivateStartConnectFunction::RunAsync() { 421 ExtensionFunction::ResponseAction NetworkingPrivateStartConnectFunction::Run() {
430 std::unique_ptr<private_api::StartConnect::Params> params = 422 std::unique_ptr<private_api::StartConnect::Params> params =
431 private_api::StartConnect::Params::Create(*args_); 423 private_api::StartConnect::Params::Create(*args_);
432 EXTENSION_FUNCTION_VALIDATE(params); 424 EXTENSION_FUNCTION_VALIDATE(params);
433 425
434 GetDelegate(browser_context()) 426 GetDelegate(browser_context())
435 ->StartConnect( 427 ->StartConnect(
436 params->network_guid, 428 params->network_guid,
437 base::Bind(&NetworkingPrivateStartConnectFunction::Success, this), 429 base::Bind(&NetworkingPrivateStartConnectFunction::Success, this),
438 base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this)); 430 base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this));
439 return true; 431 return RespondLater();
440 } 432 }
441 433
442 void NetworkingPrivateStartConnectFunction::Success() { 434 void NetworkingPrivateStartConnectFunction::Success() {
443 SendResponse(true); 435 Respond(NoArguments());
444 } 436 }
445 437
446 void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) { 438 void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) {
447 error_ = error; 439 Respond(Error(error));
448 SendResponse(false);
449 } 440 }
450 441
451 //////////////////////////////////////////////////////////////////////////////// 442 ////////////////////////////////////////////////////////////////////////////////
452 // NetworkingPrivateStartDisconnectFunction 443 // NetworkingPrivateStartDisconnectFunction
453 444
454 NetworkingPrivateStartDisconnectFunction:: 445 NetworkingPrivateStartDisconnectFunction::
455 ~NetworkingPrivateStartDisconnectFunction() { 446 ~NetworkingPrivateStartDisconnectFunction() {
456 } 447 }
457 448
458 bool NetworkingPrivateStartDisconnectFunction::RunAsync() { 449 ExtensionFunction::ResponseAction
450 NetworkingPrivateStartDisconnectFunction::Run() {
459 std::unique_ptr<private_api::StartDisconnect::Params> params = 451 std::unique_ptr<private_api::StartDisconnect::Params> params =
460 private_api::StartDisconnect::Params::Create(*args_); 452 private_api::StartDisconnect::Params::Create(*args_);
461 EXTENSION_FUNCTION_VALIDATE(params); 453 EXTENSION_FUNCTION_VALIDATE(params);
462 454
463 GetDelegate(browser_context()) 455 GetDelegate(browser_context())
464 ->StartDisconnect( 456 ->StartDisconnect(
465 params->network_guid, 457 params->network_guid,
466 base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this), 458 base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this),
467 base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this)); 459 base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this));
468 return true; 460 return RespondLater();
469 } 461 }
470 462
471 void NetworkingPrivateStartDisconnectFunction::Success() { 463 void NetworkingPrivateStartDisconnectFunction::Success() {
472 SendResponse(true); 464 Respond(NoArguments());
473 } 465 }
474 466
475 void NetworkingPrivateStartDisconnectFunction::Failure( 467 void NetworkingPrivateStartDisconnectFunction::Failure(
476 const std::string& error) { 468 const std::string& error) {
477 error_ = error; 469 Respond(Error(error));
478 SendResponse(false);
479 } 470 }
480 471
481 //////////////////////////////////////////////////////////////////////////////// 472 ////////////////////////////////////////////////////////////////////////////////
482 // NetworkingPrivateStartActivateFunction 473 // NetworkingPrivateStartActivateFunction
483 474
484 NetworkingPrivateStartActivateFunction:: 475 NetworkingPrivateStartActivateFunction::
485 ~NetworkingPrivateStartActivateFunction() { 476 ~NetworkingPrivateStartActivateFunction() {
486 } 477 }
487 478
488 bool NetworkingPrivateStartActivateFunction::RunAsync() { 479 ExtensionFunction::ResponseAction
480 NetworkingPrivateStartActivateFunction::Run() {
489 std::unique_ptr<private_api::StartActivate::Params> params = 481 std::unique_ptr<private_api::StartActivate::Params> params =
490 private_api::StartActivate::Params::Create(*args_); 482 private_api::StartActivate::Params::Create(*args_);
491 EXTENSION_FUNCTION_VALIDATE(params); 483 EXTENSION_FUNCTION_VALIDATE(params);
492 484
493 GetDelegate(browser_context()) 485 GetDelegate(browser_context())
494 ->StartActivate( 486 ->StartActivate(
495 params->network_guid, params->carrier ? *params->carrier : "", 487 params->network_guid, params->carrier ? *params->carrier : "",
496 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this), 488 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this),
497 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this)); 489 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this));
498 return true; 490 return RespondLater();
499 } 491 }
500 492
501 void NetworkingPrivateStartActivateFunction::Success() { 493 void NetworkingPrivateStartActivateFunction::Success() {
502 SendResponse(true); 494 Respond(NoArguments());
503 } 495 }
504 496
505 void NetworkingPrivateStartActivateFunction::Failure(const std::string& error) { 497 void NetworkingPrivateStartActivateFunction::Failure(const std::string& error) {
506 error_ = error; 498 Respond(Error(error));
507 SendResponse(false);
508 } 499 }
509 500
510 //////////////////////////////////////////////////////////////////////////////// 501 ////////////////////////////////////////////////////////////////////////////////
511 // NetworkingPrivateVerifyDestinationFunction 502 // NetworkingPrivateVerifyDestinationFunction
512 503
513 NetworkingPrivateVerifyDestinationFunction:: 504 NetworkingPrivateVerifyDestinationFunction::
514 ~NetworkingPrivateVerifyDestinationFunction() { 505 ~NetworkingPrivateVerifyDestinationFunction() {
515 } 506 }
516 507
517 bool NetworkingPrivateVerifyDestinationFunction::RunAsync() { 508 ExtensionFunction::ResponseAction
509 NetworkingPrivateVerifyDestinationFunction::Run() {
518 std::unique_ptr<private_api::VerifyDestination::Params> params = 510 std::unique_ptr<private_api::VerifyDestination::Params> params =
519 private_api::VerifyDestination::Params::Create(*args_); 511 private_api::VerifyDestination::Params::Create(*args_);
520 EXTENSION_FUNCTION_VALIDATE(params); 512 EXTENSION_FUNCTION_VALIDATE(params);
521 513
522 GetDelegate(browser_context()) 514 GetDelegate(browser_context())
523 ->VerifyDestination( 515 ->VerifyDestination(
524 params->properties, 516 params->properties,
525 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Success, 517 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Success,
526 this), 518 this),
527 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure, 519 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure,
528 this)); 520 this));
529 return true; 521 return RespondLater();
530 } 522 }
531 523
532 void NetworkingPrivateVerifyDestinationFunction::Success(bool result) { 524 void NetworkingPrivateVerifyDestinationFunction::Success(bool result) {
533 results_ = private_api::VerifyDestination::Results::Create(result); 525 Respond(
534 SendResponse(true); 526 ArgumentList(private_api::VerifyDestination::Results::Create(result)));
535 } 527 }
536 528
537 void NetworkingPrivateVerifyDestinationFunction::Failure( 529 void NetworkingPrivateVerifyDestinationFunction::Failure(
538 const std::string& error) { 530 const std::string& error) {
539 error_ = error; 531 Respond(Error(error));
540 SendResponse(false);
541 } 532 }
542 533
543 //////////////////////////////////////////////////////////////////////////////// 534 ////////////////////////////////////////////////////////////////////////////////
544 // NetworkingPrivateVerifyAndEncryptCredentialsFunction 535 // NetworkingPrivateVerifyAndEncryptCredentialsFunction
545 536
546 NetworkingPrivateVerifyAndEncryptCredentialsFunction:: 537 NetworkingPrivateVerifyAndEncryptCredentialsFunction::
547 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() { 538 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() {
548 } 539 }
549 540
550 bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() { 541 ExtensionFunction::ResponseAction
542 NetworkingPrivateVerifyAndEncryptCredentialsFunction::Run() {
551 std::unique_ptr<private_api::VerifyAndEncryptCredentials::Params> params = 543 std::unique_ptr<private_api::VerifyAndEncryptCredentials::Params> params =
552 private_api::VerifyAndEncryptCredentials::Params::Create(*args_); 544 private_api::VerifyAndEncryptCredentials::Params::Create(*args_);
553 EXTENSION_FUNCTION_VALIDATE(params); 545 EXTENSION_FUNCTION_VALIDATE(params);
554 546
555 GetDelegate(browser_context()) 547 GetDelegate(browser_context())
556 ->VerifyAndEncryptCredentials( 548 ->VerifyAndEncryptCredentials(
557 params->network_guid, params->properties, 549 params->network_guid, params->properties,
558 base::Bind( 550 base::Bind(
559 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success, 551 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success,
560 this), 552 this),
561 base::Bind( 553 base::Bind(
562 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure, 554 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure,
563 this)); 555 this));
564 return true; 556 return RespondLater();
565 } 557 }
566 558
567 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success( 559 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success(
568 const std::string& result) { 560 const std::string& result) {
569 results_ = private_api::VerifyAndEncryptCredentials::Results::Create(result); 561 Respond(ArgumentList(
570 SendResponse(true); 562 private_api::VerifyAndEncryptCredentials::Results::Create(result)));
571 } 563 }
572 564
573 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure( 565 void NetworkingPrivateVerifyAndEncryptCredentialsFunction::Failure(
574 const std::string& error) { 566 const std::string& error) {
575 error_ = error; 567 Respond(Error(error));
576 SendResponse(false);
577 } 568 }
578 569
579 //////////////////////////////////////////////////////////////////////////////// 570 ////////////////////////////////////////////////////////////////////////////////
580 // NetworkingPrivateVerifyAndEncryptDataFunction 571 // NetworkingPrivateVerifyAndEncryptDataFunction
581 572
582 NetworkingPrivateVerifyAndEncryptDataFunction:: 573 NetworkingPrivateVerifyAndEncryptDataFunction::
583 ~NetworkingPrivateVerifyAndEncryptDataFunction() { 574 ~NetworkingPrivateVerifyAndEncryptDataFunction() {
584 } 575 }
585 576
586 bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() { 577 ExtensionFunction::ResponseAction
578 NetworkingPrivateVerifyAndEncryptDataFunction::Run() {
587 std::unique_ptr<private_api::VerifyAndEncryptData::Params> params = 579 std::unique_ptr<private_api::VerifyAndEncryptData::Params> params =
588 private_api::VerifyAndEncryptData::Params::Create(*args_); 580 private_api::VerifyAndEncryptData::Params::Create(*args_);
589 EXTENSION_FUNCTION_VALIDATE(params); 581 EXTENSION_FUNCTION_VALIDATE(params);
590 582
591 GetDelegate(browser_context()) 583 GetDelegate(browser_context())
592 ->VerifyAndEncryptData( 584 ->VerifyAndEncryptData(
593 params->properties, params->data, 585 params->properties, params->data,
594 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Success, 586 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Success,
595 this), 587 this),
596 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure, 588 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure,
597 this)); 589 this));
598 return true; 590 return RespondLater();
599 } 591 }
600 592
601 void NetworkingPrivateVerifyAndEncryptDataFunction::Success( 593 void NetworkingPrivateVerifyAndEncryptDataFunction::Success(
602 const std::string& result) { 594 const std::string& result) {
603 results_ = private_api::VerifyAndEncryptData::Results::Create(result); 595 Respond(
604 SendResponse(true); 596 ArgumentList(private_api::VerifyAndEncryptData::Results::Create(result)));
605 } 597 }
606 598
607 void NetworkingPrivateVerifyAndEncryptDataFunction::Failure( 599 void NetworkingPrivateVerifyAndEncryptDataFunction::Failure(
608 const std::string& error) { 600 const std::string& error) {
609 error_ = error; 601 Respond(Error(error));
610 SendResponse(false);
611 } 602 }
612 603
613 //////////////////////////////////////////////////////////////////////////////// 604 ////////////////////////////////////////////////////////////////////////////////
614 // NetworkingPrivateSetWifiTDLSEnabledStateFunction 605 // NetworkingPrivateSetWifiTDLSEnabledStateFunction
615 606
616 NetworkingPrivateSetWifiTDLSEnabledStateFunction:: 607 NetworkingPrivateSetWifiTDLSEnabledStateFunction::
617 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() { 608 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() {
618 } 609 }
619 610
620 bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() { 611 ExtensionFunction::ResponseAction
612 NetworkingPrivateSetWifiTDLSEnabledStateFunction::Run() {
621 std::unique_ptr<private_api::SetWifiTDLSEnabledState::Params> params = 613 std::unique_ptr<private_api::SetWifiTDLSEnabledState::Params> params =
622 private_api::SetWifiTDLSEnabledState::Params::Create(*args_); 614 private_api::SetWifiTDLSEnabledState::Params::Create(*args_);
623 EXTENSION_FUNCTION_VALIDATE(params); 615 EXTENSION_FUNCTION_VALIDATE(params);
624 616
625 GetDelegate(browser_context()) 617 GetDelegate(browser_context())
626 ->SetWifiTDLSEnabledState( 618 ->SetWifiTDLSEnabledState(
627 params->ip_or_mac_address, params->enabled, 619 params->ip_or_mac_address, params->enabled,
628 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success, 620 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success,
629 this), 621 this),
630 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure, 622 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure,
631 this)); 623 this));
632 624
633 return true; 625 return RespondLater();
634 } 626 }
635 627
636 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success( 628 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success(
637 const std::string& result) { 629 const std::string& result) {
638 results_ = private_api::SetWifiTDLSEnabledState::Results::Create(result); 630 Respond(ArgumentList(
639 SendResponse(true); 631 private_api::SetWifiTDLSEnabledState::Results::Create(result)));
640 } 632 }
641 633
642 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure( 634 void NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure(
643 const std::string& error) { 635 const std::string& error) {
644 error_ = error; 636 Respond(Error(error));
645 SendResponse(false);
646 } 637 }
647 638
648 //////////////////////////////////////////////////////////////////////////////// 639 ////////////////////////////////////////////////////////////////////////////////
649 // NetworkingPrivateGetWifiTDLSStatusFunction 640 // NetworkingPrivateGetWifiTDLSStatusFunction
650 641
651 NetworkingPrivateGetWifiTDLSStatusFunction:: 642 NetworkingPrivateGetWifiTDLSStatusFunction::
652 ~NetworkingPrivateGetWifiTDLSStatusFunction() { 643 ~NetworkingPrivateGetWifiTDLSStatusFunction() {
653 } 644 }
654 645
655 bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() { 646 ExtensionFunction::ResponseAction
647 NetworkingPrivateGetWifiTDLSStatusFunction::Run() {
656 std::unique_ptr<private_api::GetWifiTDLSStatus::Params> params = 648 std::unique_ptr<private_api::GetWifiTDLSStatus::Params> params =
657 private_api::GetWifiTDLSStatus::Params::Create(*args_); 649 private_api::GetWifiTDLSStatus::Params::Create(*args_);
658 EXTENSION_FUNCTION_VALIDATE(params); 650 EXTENSION_FUNCTION_VALIDATE(params);
659 651
660 GetDelegate(browser_context()) 652 GetDelegate(browser_context())
661 ->GetWifiTDLSStatus( 653 ->GetWifiTDLSStatus(
662 params->ip_or_mac_address, 654 params->ip_or_mac_address,
663 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Success, 655 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Success,
664 this), 656 this),
665 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure, 657 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure,
666 this)); 658 this));
667 659
668 return true; 660 return RespondLater();
669 } 661 }
670 662
671 void NetworkingPrivateGetWifiTDLSStatusFunction::Success( 663 void NetworkingPrivateGetWifiTDLSStatusFunction::Success(
672 const std::string& result) { 664 const std::string& result) {
673 results_ = private_api::GetWifiTDLSStatus::Results::Create(result); 665 Respond(
674 SendResponse(true); 666 ArgumentList(private_api::GetWifiTDLSStatus::Results::Create(result)));
675 } 667 }
676 668
677 void NetworkingPrivateGetWifiTDLSStatusFunction::Failure( 669 void NetworkingPrivateGetWifiTDLSStatusFunction::Failure(
678 const std::string& error) { 670 const std::string& error) {
679 error_ = error; 671 Respond(Error(error));
680 SendResponse(false);
681 } 672 }
682 673
683 //////////////////////////////////////////////////////////////////////////////// 674 ////////////////////////////////////////////////////////////////////////////////
684 // NetworkingPrivateGetCaptivePortalStatusFunction 675 // NetworkingPrivateGetCaptivePortalStatusFunction
685 676
686 NetworkingPrivateGetCaptivePortalStatusFunction:: 677 NetworkingPrivateGetCaptivePortalStatusFunction::
687 ~NetworkingPrivateGetCaptivePortalStatusFunction() { 678 ~NetworkingPrivateGetCaptivePortalStatusFunction() {
688 } 679 }
689 680
690 bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { 681 ExtensionFunction::ResponseAction
682 NetworkingPrivateGetCaptivePortalStatusFunction::Run() {
691 std::unique_ptr<private_api::GetCaptivePortalStatus::Params> params = 683 std::unique_ptr<private_api::GetCaptivePortalStatus::Params> params =
692 private_api::GetCaptivePortalStatus::Params::Create(*args_); 684 private_api::GetCaptivePortalStatus::Params::Create(*args_);
693 EXTENSION_FUNCTION_VALIDATE(params); 685 EXTENSION_FUNCTION_VALIDATE(params);
694 686
695 GetDelegate(browser_context()) 687 GetDelegate(browser_context())
696 ->GetCaptivePortalStatus( 688 ->GetCaptivePortalStatus(
697 params->network_guid, 689 params->network_guid,
698 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Success, 690 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Success,
699 this), 691 this),
700 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure, 692 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure,
701 this)); 693 this));
702 return true; 694 return RespondLater();
703 } 695 }
704 696
705 void NetworkingPrivateGetCaptivePortalStatusFunction::Success( 697 void NetworkingPrivateGetCaptivePortalStatusFunction::Success(
706 const std::string& result) { 698 const std::string& result) {
707 results_ = private_api::GetCaptivePortalStatus::Results::Create( 699 Respond(ArgumentList(private_api::GetCaptivePortalStatus::Results::Create(
708 private_api::ParseCaptivePortalStatus(result)); 700 private_api::ParseCaptivePortalStatus(result))));
709 SendResponse(true);
710 } 701 }
711 702
712 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( 703 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure(
713 const std::string& error) { 704 const std::string& error) {
714 error_ = error; 705 Respond(Error(error));
715 SendResponse(false);
716 } 706 }
717 707
718 //////////////////////////////////////////////////////////////////////////////// 708 ////////////////////////////////////////////////////////////////////////////////
719 // NetworkingPrivateUnlockCellularSimFunction 709 // NetworkingPrivateUnlockCellularSimFunction
720 710
721 NetworkingPrivateUnlockCellularSimFunction:: 711 NetworkingPrivateUnlockCellularSimFunction::
722 ~NetworkingPrivateUnlockCellularSimFunction() {} 712 ~NetworkingPrivateUnlockCellularSimFunction() {}
723 713
724 bool NetworkingPrivateUnlockCellularSimFunction::RunAsync() { 714 ExtensionFunction::ResponseAction
715 NetworkingPrivateUnlockCellularSimFunction::Run() {
725 std::unique_ptr<private_api::UnlockCellularSim::Params> params = 716 std::unique_ptr<private_api::UnlockCellularSim::Params> params =
726 private_api::UnlockCellularSim::Params::Create(*args_); 717 private_api::UnlockCellularSim::Params::Create(*args_);
727 EXTENSION_FUNCTION_VALIDATE(params); 718 EXTENSION_FUNCTION_VALIDATE(params);
728 719
729 GetDelegate(browser_context()) 720 GetDelegate(browser_context())
730 ->UnlockCellularSim( 721 ->UnlockCellularSim(
731 params->network_guid, params->pin, params->puk ? *params->puk : "", 722 params->network_guid, params->pin, params->puk ? *params->puk : "",
732 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Success, 723 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Success,
733 this), 724 this),
734 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure, 725 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure,
735 this)); 726 this));
736 return true; 727 return RespondLater();
737 } 728 }
738 729
739 void NetworkingPrivateUnlockCellularSimFunction::Success() { 730 void NetworkingPrivateUnlockCellularSimFunction::Success() {
740 SendResponse(true); 731 Respond(NoArguments());
741 } 732 }
742 733
743 void NetworkingPrivateUnlockCellularSimFunction::Failure( 734 void NetworkingPrivateUnlockCellularSimFunction::Failure(
744 const std::string& error) { 735 const std::string& error) {
745 error_ = error; 736 Respond(Error(error));
746 SendResponse(false);
747 } 737 }
748 738
749 //////////////////////////////////////////////////////////////////////////////// 739 ////////////////////////////////////////////////////////////////////////////////
750 // NetworkingPrivateSetCellularSimStateFunction 740 // NetworkingPrivateSetCellularSimStateFunction
751 741
752 NetworkingPrivateSetCellularSimStateFunction:: 742 NetworkingPrivateSetCellularSimStateFunction::
753 ~NetworkingPrivateSetCellularSimStateFunction() {} 743 ~NetworkingPrivateSetCellularSimStateFunction() {}
754 744
755 bool NetworkingPrivateSetCellularSimStateFunction::RunAsync() { 745 ExtensionFunction::ResponseAction
746 NetworkingPrivateSetCellularSimStateFunction::Run() {
756 std::unique_ptr<private_api::SetCellularSimState::Params> params = 747 std::unique_ptr<private_api::SetCellularSimState::Params> params =
757 private_api::SetCellularSimState::Params::Create(*args_); 748 private_api::SetCellularSimState::Params::Create(*args_);
758 EXTENSION_FUNCTION_VALIDATE(params); 749 EXTENSION_FUNCTION_VALIDATE(params);
759 750
760 GetDelegate(browser_context()) 751 GetDelegate(browser_context())
761 ->SetCellularSimState( 752 ->SetCellularSimState(
762 params->network_guid, params->sim_state.require_pin, 753 params->network_guid, params->sim_state.require_pin,
763 params->sim_state.current_pin, 754 params->sim_state.current_pin,
764 params->sim_state.new_pin ? *params->sim_state.new_pin : "", 755 params->sim_state.new_pin ? *params->sim_state.new_pin : "",
765 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Success, 756 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Success,
766 this), 757 this),
767 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Failure, 758 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Failure,
768 this)); 759 this));
769 return true; 760 return RespondLater();
770 } 761 }
771 762
772 void NetworkingPrivateSetCellularSimStateFunction::Success() { 763 void NetworkingPrivateSetCellularSimStateFunction::Success() {
773 SendResponse(true); 764 Respond(NoArguments());
774 } 765 }
775 766
776 void NetworkingPrivateSetCellularSimStateFunction::Failure( 767 void NetworkingPrivateSetCellularSimStateFunction::Failure(
777 const std::string& error) { 768 const std::string& error) {
778 error_ = error; 769 Respond(Error(error));
779 SendResponse(false);
780 } 770 }
781 771
782 } // namespace extensions 772 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698