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

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

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "components/onc/onc_constants.h" 10 #include "components/onc/onc_constants.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } // namespace networking_private 43 } // namespace networking_private
44 44
45 //////////////////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////////////////
46 // NetworkingPrivateGetPropertiesFunction 46 // NetworkingPrivateGetPropertiesFunction
47 47
48 NetworkingPrivateGetPropertiesFunction:: 48 NetworkingPrivateGetPropertiesFunction::
49 ~NetworkingPrivateGetPropertiesFunction() { 49 ~NetworkingPrivateGetPropertiesFunction() {
50 } 50 }
51 51
52 bool NetworkingPrivateGetPropertiesFunction::RunAsync() { 52 bool NetworkingPrivateGetPropertiesFunction::RunAsync() {
53 scoped_ptr<private_api::GetProperties::Params> params = 53 std::unique_ptr<private_api::GetProperties::Params> params =
54 private_api::GetProperties::Params::Create(*args_); 54 private_api::GetProperties::Params::Create(*args_);
55 EXTENSION_FUNCTION_VALIDATE(params); 55 EXTENSION_FUNCTION_VALIDATE(params);
56 56
57 GetDelegate(browser_context()) 57 GetDelegate(browser_context())
58 ->GetProperties( 58 ->GetProperties(
59 params->network_guid, 59 params->network_guid,
60 base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this), 60 base::Bind(&NetworkingPrivateGetPropertiesFunction::Success, this),
61 base::Bind(&NetworkingPrivateGetPropertiesFunction::Failure, this)); 61 base::Bind(&NetworkingPrivateGetPropertiesFunction::Failure, this));
62 return true; 62 return true;
63 } 63 }
64 64
65 void NetworkingPrivateGetPropertiesFunction::Success( 65 void NetworkingPrivateGetPropertiesFunction::Success(
66 scoped_ptr<base::DictionaryValue> result) { 66 std::unique_ptr<base::DictionaryValue> result) {
67 SetResult(result.release()); 67 SetResult(result.release());
68 SendResponse(true); 68 SendResponse(true);
69 } 69 }
70 70
71 void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) { 71 void NetworkingPrivateGetPropertiesFunction::Failure(const std::string& error) {
72 error_ = error; 72 error_ = error;
73 SendResponse(false); 73 SendResponse(false);
74 } 74 }
75 75
76 //////////////////////////////////////////////////////////////////////////////// 76 ////////////////////////////////////////////////////////////////////////////////
77 // NetworkingPrivateGetManagedPropertiesFunction 77 // NetworkingPrivateGetManagedPropertiesFunction
78 78
79 NetworkingPrivateGetManagedPropertiesFunction:: 79 NetworkingPrivateGetManagedPropertiesFunction::
80 ~NetworkingPrivateGetManagedPropertiesFunction() { 80 ~NetworkingPrivateGetManagedPropertiesFunction() {
81 } 81 }
82 82
83 bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() { 83 bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() {
84 scoped_ptr<private_api::GetManagedProperties::Params> params = 84 std::unique_ptr<private_api::GetManagedProperties::Params> params =
85 private_api::GetManagedProperties::Params::Create(*args_); 85 private_api::GetManagedProperties::Params::Create(*args_);
86 EXTENSION_FUNCTION_VALIDATE(params); 86 EXTENSION_FUNCTION_VALIDATE(params);
87 87
88 GetDelegate(browser_context()) 88 GetDelegate(browser_context())
89 ->GetManagedProperties( 89 ->GetManagedProperties(
90 params->network_guid, 90 params->network_guid,
91 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, 91 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success,
92 this), 92 this),
93 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, 93 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure,
94 this)); 94 this));
95 return true; 95 return true;
96 } 96 }
97 97
98 void NetworkingPrivateGetManagedPropertiesFunction::Success( 98 void NetworkingPrivateGetManagedPropertiesFunction::Success(
99 scoped_ptr<base::DictionaryValue> result) { 99 std::unique_ptr<base::DictionaryValue> result) {
100 SetResult(result.release()); 100 SetResult(result.release());
101 SendResponse(true); 101 SendResponse(true);
102 } 102 }
103 103
104 void NetworkingPrivateGetManagedPropertiesFunction::Failure( 104 void NetworkingPrivateGetManagedPropertiesFunction::Failure(
105 const std::string& error) { 105 const std::string& error) {
106 error_ = error; 106 error_ = error;
107 SendResponse(false); 107 SendResponse(false);
108 } 108 }
109 109
110 //////////////////////////////////////////////////////////////////////////////// 110 ////////////////////////////////////////////////////////////////////////////////
111 // NetworkingPrivateGetStateFunction 111 // NetworkingPrivateGetStateFunction
112 112
113 NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() { 113 NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() {
114 } 114 }
115 115
116 bool NetworkingPrivateGetStateFunction::RunAsync() { 116 bool NetworkingPrivateGetStateFunction::RunAsync() {
117 scoped_ptr<private_api::GetState::Params> params = 117 std::unique_ptr<private_api::GetState::Params> params =
118 private_api::GetState::Params::Create(*args_); 118 private_api::GetState::Params::Create(*args_);
119 EXTENSION_FUNCTION_VALIDATE(params); 119 EXTENSION_FUNCTION_VALIDATE(params);
120 120
121 GetDelegate(browser_context()) 121 GetDelegate(browser_context())
122 ->GetState(params->network_guid, 122 ->GetState(params->network_guid,
123 base::Bind(&NetworkingPrivateGetStateFunction::Success, this), 123 base::Bind(&NetworkingPrivateGetStateFunction::Success, this),
124 base::Bind(&NetworkingPrivateGetStateFunction::Failure, this)); 124 base::Bind(&NetworkingPrivateGetStateFunction::Failure, this));
125 return true; 125 return true;
126 } 126 }
127 127
128 void NetworkingPrivateGetStateFunction::Success( 128 void NetworkingPrivateGetStateFunction::Success(
129 scoped_ptr<base::DictionaryValue> result) { 129 std::unique_ptr<base::DictionaryValue> result) {
130 SetResult(result.release()); 130 SetResult(result.release());
131 SendResponse(true); 131 SendResponse(true);
132 } 132 }
133 133
134 void NetworkingPrivateGetStateFunction::Failure(const std::string& error) { 134 void NetworkingPrivateGetStateFunction::Failure(const std::string& error) {
135 error_ = error; 135 error_ = error;
136 SendResponse(false); 136 SendResponse(false);
137 } 137 }
138 138
139 //////////////////////////////////////////////////////////////////////////////// 139 ////////////////////////////////////////////////////////////////////////////////
140 // NetworkingPrivateSetPropertiesFunction 140 // NetworkingPrivateSetPropertiesFunction
141 141
142 NetworkingPrivateSetPropertiesFunction:: 142 NetworkingPrivateSetPropertiesFunction::
143 ~NetworkingPrivateSetPropertiesFunction() { 143 ~NetworkingPrivateSetPropertiesFunction() {
144 } 144 }
145 145
146 bool NetworkingPrivateSetPropertiesFunction::RunAsync() { 146 bool NetworkingPrivateSetPropertiesFunction::RunAsync() {
147 scoped_ptr<private_api::SetProperties::Params> params = 147 std::unique_ptr<private_api::SetProperties::Params> params =
148 private_api::SetProperties::Params::Create(*args_); 148 private_api::SetProperties::Params::Create(*args_);
149 EXTENSION_FUNCTION_VALIDATE(params); 149 EXTENSION_FUNCTION_VALIDATE(params);
150 150
151 scoped_ptr<base::DictionaryValue> properties_dict( 151 std::unique_ptr<base::DictionaryValue> properties_dict(
152 params->properties.ToValue()); 152 params->properties.ToValue());
153 153
154 GetDelegate(browser_context()) 154 GetDelegate(browser_context())
155 ->SetProperties( 155 ->SetProperties(
156 params->network_guid, std::move(properties_dict), 156 params->network_guid, std::move(properties_dict),
157 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this), 157 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this),
158 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this)); 158 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this));
159 return true; 159 return true;
160 } 160 }
161 161
162 void NetworkingPrivateSetPropertiesFunction::Success() { 162 void NetworkingPrivateSetPropertiesFunction::Success() {
163 SendResponse(true); 163 SendResponse(true);
164 } 164 }
165 165
166 void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) { 166 void NetworkingPrivateSetPropertiesFunction::Failure(const std::string& error) {
167 error_ = error; 167 error_ = error;
168 SendResponse(false); 168 SendResponse(false);
169 } 169 }
170 170
171 //////////////////////////////////////////////////////////////////////////////// 171 ////////////////////////////////////////////////////////////////////////////////
172 // NetworkingPrivateCreateNetworkFunction 172 // NetworkingPrivateCreateNetworkFunction
173 173
174 NetworkingPrivateCreateNetworkFunction:: 174 NetworkingPrivateCreateNetworkFunction::
175 ~NetworkingPrivateCreateNetworkFunction() { 175 ~NetworkingPrivateCreateNetworkFunction() {
176 } 176 }
177 177
178 bool NetworkingPrivateCreateNetworkFunction::RunAsync() { 178 bool NetworkingPrivateCreateNetworkFunction::RunAsync() {
179 scoped_ptr<private_api::CreateNetwork::Params> params = 179 std::unique_ptr<private_api::CreateNetwork::Params> params =
180 private_api::CreateNetwork::Params::Create(*args_); 180 private_api::CreateNetwork::Params::Create(*args_);
181 EXTENSION_FUNCTION_VALIDATE(params); 181 EXTENSION_FUNCTION_VALIDATE(params);
182 182
183 scoped_ptr<base::DictionaryValue> properties_dict( 183 std::unique_ptr<base::DictionaryValue> properties_dict(
184 params->properties.ToValue()); 184 params->properties.ToValue());
185 185
186 GetDelegate(browser_context()) 186 GetDelegate(browser_context())
187 ->CreateNetwork( 187 ->CreateNetwork(
188 params->shared, std::move(properties_dict), 188 params->shared, std::move(properties_dict),
189 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this), 189 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this),
190 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this)); 190 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this));
191 return true; 191 return true;
192 } 192 }
193 193
194 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) { 194 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) {
195 results_ = private_api::CreateNetwork::Results::Create(guid); 195 results_ = private_api::CreateNetwork::Results::Create(guid);
196 SendResponse(true); 196 SendResponse(true);
197 } 197 }
198 198
199 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) { 199 void NetworkingPrivateCreateNetworkFunction::Failure(const std::string& error) {
200 error_ = error; 200 error_ = error;
201 SendResponse(false); 201 SendResponse(false);
202 } 202 }
203 203
204 //////////////////////////////////////////////////////////////////////////////// 204 ////////////////////////////////////////////////////////////////////////////////
205 // NetworkingPrivateForgetNetworkFunction 205 // NetworkingPrivateForgetNetworkFunction
206 206
207 NetworkingPrivateForgetNetworkFunction:: 207 NetworkingPrivateForgetNetworkFunction::
208 ~NetworkingPrivateForgetNetworkFunction() { 208 ~NetworkingPrivateForgetNetworkFunction() {
209 } 209 }
210 210
211 bool NetworkingPrivateForgetNetworkFunction::RunAsync() { 211 bool NetworkingPrivateForgetNetworkFunction::RunAsync() {
212 scoped_ptr<private_api::ForgetNetwork::Params> params = 212 std::unique_ptr<private_api::ForgetNetwork::Params> params =
213 private_api::ForgetNetwork::Params::Create(*args_); 213 private_api::ForgetNetwork::Params::Create(*args_);
214 EXTENSION_FUNCTION_VALIDATE(params); 214 EXTENSION_FUNCTION_VALIDATE(params);
215 215
216 GetDelegate(browser_context()) 216 GetDelegate(browser_context())
217 ->ForgetNetwork( 217 ->ForgetNetwork(
218 params->network_guid, 218 params->network_guid,
219 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this), 219 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this),
220 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this)); 220 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this));
221 return true; 221 return true;
222 } 222 }
223 223
224 void NetworkingPrivateForgetNetworkFunction::Success() { 224 void NetworkingPrivateForgetNetworkFunction::Success() {
225 SendResponse(true); 225 SendResponse(true);
226 } 226 }
227 227
228 void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) { 228 void NetworkingPrivateForgetNetworkFunction::Failure(const std::string& error) {
229 error_ = error; 229 error_ = error;
230 SendResponse(false); 230 SendResponse(false);
231 } 231 }
232 232
233 //////////////////////////////////////////////////////////////////////////////// 233 ////////////////////////////////////////////////////////////////////////////////
234 // NetworkingPrivateGetNetworksFunction 234 // NetworkingPrivateGetNetworksFunction
235 235
236 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() { 236 NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() {
237 } 237 }
238 238
239 bool NetworkingPrivateGetNetworksFunction::RunAsync() { 239 bool NetworkingPrivateGetNetworksFunction::RunAsync() {
240 scoped_ptr<private_api::GetNetworks::Params> params = 240 std::unique_ptr<private_api::GetNetworks::Params> params =
241 private_api::GetNetworks::Params::Create(*args_); 241 private_api::GetNetworks::Params::Create(*args_);
242 EXTENSION_FUNCTION_VALIDATE(params); 242 EXTENSION_FUNCTION_VALIDATE(params);
243 243
244 std::string network_type = private_api::ToString(params->filter.network_type); 244 std::string network_type = private_api::ToString(params->filter.network_type);
245 const bool configured_only = 245 const bool configured_only =
246 params->filter.configured ? *params->filter.configured : false; 246 params->filter.configured ? *params->filter.configured : false;
247 const bool visible_only = 247 const bool visible_only =
248 params->filter.visible ? *params->filter.visible : false; 248 params->filter.visible ? *params->filter.visible : false;
249 const int limit = 249 const int limit =
250 params->filter.limit ? *params->filter.limit : kDefaultNetworkListLimit; 250 params->filter.limit ? *params->filter.limit : kDefaultNetworkListLimit;
251 251
252 GetDelegate(browser_context()) 252 GetDelegate(browser_context())
253 ->GetNetworks( 253 ->GetNetworks(
254 network_type, configured_only, visible_only, limit, 254 network_type, configured_only, visible_only, limit,
255 base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this), 255 base::Bind(&NetworkingPrivateGetNetworksFunction::Success, this),
256 base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this)); 256 base::Bind(&NetworkingPrivateGetNetworksFunction::Failure, this));
257 return true; 257 return true;
258 } 258 }
259 259
260 void NetworkingPrivateGetNetworksFunction::Success( 260 void NetworkingPrivateGetNetworksFunction::Success(
261 scoped_ptr<base::ListValue> network_list) { 261 std::unique_ptr<base::ListValue> network_list) {
262 SetResult(network_list.release()); 262 SetResult(network_list.release());
263 SendResponse(true); 263 SendResponse(true);
264 } 264 }
265 265
266 void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) { 266 void NetworkingPrivateGetNetworksFunction::Failure(const std::string& error) {
267 error_ = error; 267 error_ = error;
268 SendResponse(false); 268 SendResponse(false);
269 } 269 }
270 270
271 //////////////////////////////////////////////////////////////////////////////// 271 ////////////////////////////////////////////////////////////////////////////////
272 // NetworkingPrivateGetVisibleNetworksFunction 272 // NetworkingPrivateGetVisibleNetworksFunction
273 273
274 NetworkingPrivateGetVisibleNetworksFunction:: 274 NetworkingPrivateGetVisibleNetworksFunction::
275 ~NetworkingPrivateGetVisibleNetworksFunction() { 275 ~NetworkingPrivateGetVisibleNetworksFunction() {
276 } 276 }
277 277
278 bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() { 278 bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() {
279 scoped_ptr<private_api::GetVisibleNetworks::Params> params = 279 std::unique_ptr<private_api::GetVisibleNetworks::Params> params =
280 private_api::GetVisibleNetworks::Params::Create(*args_); 280 private_api::GetVisibleNetworks::Params::Create(*args_);
281 EXTENSION_FUNCTION_VALIDATE(params); 281 EXTENSION_FUNCTION_VALIDATE(params);
282 282
283 std::string network_type = private_api::ToString(params->network_type); 283 std::string network_type = private_api::ToString(params->network_type);
284 const bool configured_only = false; 284 const bool configured_only = false;
285 const bool visible_only = true; 285 const bool visible_only = true;
286 286
287 GetDelegate(browser_context()) 287 GetDelegate(browser_context())
288 ->GetNetworks( 288 ->GetNetworks(
289 network_type, configured_only, visible_only, kDefaultNetworkListLimit, 289 network_type, configured_only, visible_only, kDefaultNetworkListLimit,
290 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Success, 290 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Success,
291 this), 291 this),
292 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure, 292 base::Bind(&NetworkingPrivateGetVisibleNetworksFunction::Failure,
293 this)); 293 this));
294 return true; 294 return true;
295 } 295 }
296 296
297 void NetworkingPrivateGetVisibleNetworksFunction::Success( 297 void NetworkingPrivateGetVisibleNetworksFunction::Success(
298 scoped_ptr<base::ListValue> network_properties_list) { 298 std::unique_ptr<base::ListValue> network_properties_list) {
299 SetResult(network_properties_list.release()); 299 SetResult(network_properties_list.release());
300 SendResponse(true); 300 SendResponse(true);
301 } 301 }
302 302
303 void NetworkingPrivateGetVisibleNetworksFunction::Failure( 303 void NetworkingPrivateGetVisibleNetworksFunction::Failure(
304 const std::string& error) { 304 const std::string& error) {
305 error_ = error; 305 error_ = error;
306 SendResponse(false); 306 SendResponse(false);
307 } 307 }
308 308
309 //////////////////////////////////////////////////////////////////////////////// 309 ////////////////////////////////////////////////////////////////////////////////
310 // NetworkingPrivateGetEnabledNetworkTypesFunction 310 // NetworkingPrivateGetEnabledNetworkTypesFunction
311 311
312 NetworkingPrivateGetEnabledNetworkTypesFunction:: 312 NetworkingPrivateGetEnabledNetworkTypesFunction::
313 ~NetworkingPrivateGetEnabledNetworkTypesFunction() { 313 ~NetworkingPrivateGetEnabledNetworkTypesFunction() {
314 } 314 }
315 315
316 bool NetworkingPrivateGetEnabledNetworkTypesFunction::RunSync() { 316 bool NetworkingPrivateGetEnabledNetworkTypesFunction::RunSync() {
317 scoped_ptr<base::ListValue> enabled_networks_onc_types( 317 std::unique_ptr<base::ListValue> enabled_networks_onc_types(
318 GetDelegate(browser_context())->GetEnabledNetworkTypes()); 318 GetDelegate(browser_context())->GetEnabledNetworkTypes());
319 if (!enabled_networks_onc_types) { 319 if (!enabled_networks_onc_types) {
320 error_ = networking_private::kErrorNotSupported; 320 error_ = networking_private::kErrorNotSupported;
321 return false; 321 return false;
322 } 322 }
323 scoped_ptr<base::ListValue> enabled_networks_list(new base::ListValue); 323 std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue);
324 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin(); 324 for (base::ListValue::iterator iter = enabled_networks_onc_types->begin();
325 iter != enabled_networks_onc_types->end(); ++iter) { 325 iter != enabled_networks_onc_types->end(); ++iter) {
326 std::string type; 326 std::string type;
327 if (!(*iter)->GetAsString(&type)) 327 if (!(*iter)->GetAsString(&type))
328 NOTREACHED(); 328 NOTREACHED();
329 if (type == ::onc::network_type::kEthernet) { 329 if (type == ::onc::network_type::kEthernet) {
330 enabled_networks_list->AppendString( 330 enabled_networks_list->AppendString(
331 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET)); 331 private_api::ToString(private_api::NETWORK_TYPE_ETHERNET));
332 } else if (type == ::onc::network_type::kWiFi) { 332 } else if (type == ::onc::network_type::kWiFi) {
333 enabled_networks_list->AppendString( 333 enabled_networks_list->AppendString(
(...skipping 13 matching lines...) Expand all
347 } 347 }
348 348
349 //////////////////////////////////////////////////////////////////////////////// 349 ////////////////////////////////////////////////////////////////////////////////
350 // NetworkingPrivateGetDeviceStatesFunction 350 // NetworkingPrivateGetDeviceStatesFunction
351 351
352 NetworkingPrivateGetDeviceStatesFunction:: 352 NetworkingPrivateGetDeviceStatesFunction::
353 ~NetworkingPrivateGetDeviceStatesFunction() { 353 ~NetworkingPrivateGetDeviceStatesFunction() {
354 } 354 }
355 355
356 bool NetworkingPrivateGetDeviceStatesFunction::RunSync() { 356 bool NetworkingPrivateGetDeviceStatesFunction::RunSync() {
357 scoped_ptr<NetworkingPrivateDelegate::DeviceStateList> device_states( 357 std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList> device_states(
358 GetDelegate(browser_context())->GetDeviceStateList()); 358 GetDelegate(browser_context())->GetDeviceStateList());
359 if (!device_states) { 359 if (!device_states) {
360 error_ = networking_private::kErrorNotSupported; 360 error_ = networking_private::kErrorNotSupported;
361 return false; 361 return false;
362 } 362 }
363 363
364 scoped_ptr<base::ListValue> device_state_list(new base::ListValue); 364 std::unique_ptr<base::ListValue> device_state_list(new base::ListValue);
365 for (const auto& properties : *device_states) 365 for (const auto& properties : *device_states)
366 device_state_list->Append(properties->ToValue().release()); 366 device_state_list->Append(properties->ToValue().release());
367 SetResult(device_state_list.release()); 367 SetResult(device_state_list.release());
368 return true; 368 return true;
369 } 369 }
370 370
371 //////////////////////////////////////////////////////////////////////////////// 371 ////////////////////////////////////////////////////////////////////////////////
372 // NetworkingPrivateEnableNetworkTypeFunction 372 // NetworkingPrivateEnableNetworkTypeFunction
373 373
374 NetworkingPrivateEnableNetworkTypeFunction:: 374 NetworkingPrivateEnableNetworkTypeFunction::
375 ~NetworkingPrivateEnableNetworkTypeFunction() { 375 ~NetworkingPrivateEnableNetworkTypeFunction() {
376 } 376 }
377 377
378 bool NetworkingPrivateEnableNetworkTypeFunction::RunSync() { 378 bool NetworkingPrivateEnableNetworkTypeFunction::RunSync() {
379 scoped_ptr<private_api::EnableNetworkType::Params> params = 379 std::unique_ptr<private_api::EnableNetworkType::Params> params =
380 private_api::EnableNetworkType::Params::Create(*args_); 380 private_api::EnableNetworkType::Params::Create(*args_);
381 EXTENSION_FUNCTION_VALIDATE(params); 381 EXTENSION_FUNCTION_VALIDATE(params);
382 382
383 return GetDelegate(browser_context()) 383 return GetDelegate(browser_context())
384 ->EnableNetworkType(private_api::ToString(params->network_type)); 384 ->EnableNetworkType(private_api::ToString(params->network_type));
385 } 385 }
386 386
387 //////////////////////////////////////////////////////////////////////////////// 387 ////////////////////////////////////////////////////////////////////////////////
388 // NetworkingPrivateDisableNetworkTypeFunction 388 // NetworkingPrivateDisableNetworkTypeFunction
389 389
390 NetworkingPrivateDisableNetworkTypeFunction:: 390 NetworkingPrivateDisableNetworkTypeFunction::
391 ~NetworkingPrivateDisableNetworkTypeFunction() { 391 ~NetworkingPrivateDisableNetworkTypeFunction() {
392 } 392 }
393 393
394 bool NetworkingPrivateDisableNetworkTypeFunction::RunSync() { 394 bool NetworkingPrivateDisableNetworkTypeFunction::RunSync() {
395 scoped_ptr<private_api::DisableNetworkType::Params> params = 395 std::unique_ptr<private_api::DisableNetworkType::Params> params =
396 private_api::DisableNetworkType::Params::Create(*args_); 396 private_api::DisableNetworkType::Params::Create(*args_);
397 397
398 return GetDelegate(browser_context()) 398 return GetDelegate(browser_context())
399 ->DisableNetworkType(private_api::ToString(params->network_type)); 399 ->DisableNetworkType(private_api::ToString(params->network_type));
400 } 400 }
401 401
402 //////////////////////////////////////////////////////////////////////////////// 402 ////////////////////////////////////////////////////////////////////////////////
403 // NetworkingPrivateRequestNetworkScanFunction 403 // NetworkingPrivateRequestNetworkScanFunction
404 404
405 NetworkingPrivateRequestNetworkScanFunction:: 405 NetworkingPrivateRequestNetworkScanFunction::
406 ~NetworkingPrivateRequestNetworkScanFunction() { 406 ~NetworkingPrivateRequestNetworkScanFunction() {
407 } 407 }
408 408
409 bool NetworkingPrivateRequestNetworkScanFunction::RunSync() { 409 bool NetworkingPrivateRequestNetworkScanFunction::RunSync() {
410 return GetDelegate(browser_context())->RequestScan(); 410 return GetDelegate(browser_context())->RequestScan();
411 } 411 }
412 412
413 //////////////////////////////////////////////////////////////////////////////// 413 ////////////////////////////////////////////////////////////////////////////////
414 // NetworkingPrivateStartConnectFunction 414 // NetworkingPrivateStartConnectFunction
415 415
416 NetworkingPrivateStartConnectFunction:: 416 NetworkingPrivateStartConnectFunction::
417 ~NetworkingPrivateStartConnectFunction() { 417 ~NetworkingPrivateStartConnectFunction() {
418 } 418 }
419 419
420 bool NetworkingPrivateStartConnectFunction::RunAsync() { 420 bool NetworkingPrivateStartConnectFunction::RunAsync() {
421 scoped_ptr<private_api::StartConnect::Params> params = 421 std::unique_ptr<private_api::StartConnect::Params> params =
422 private_api::StartConnect::Params::Create(*args_); 422 private_api::StartConnect::Params::Create(*args_);
423 EXTENSION_FUNCTION_VALIDATE(params); 423 EXTENSION_FUNCTION_VALIDATE(params);
424 424
425 GetDelegate(browser_context()) 425 GetDelegate(browser_context())
426 ->StartConnect( 426 ->StartConnect(
427 params->network_guid, 427 params->network_guid,
428 base::Bind(&NetworkingPrivateStartConnectFunction::Success, this), 428 base::Bind(&NetworkingPrivateStartConnectFunction::Success, this),
429 base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this)); 429 base::Bind(&NetworkingPrivateStartConnectFunction::Failure, this));
430 return true; 430 return true;
431 } 431 }
432 432
433 void NetworkingPrivateStartConnectFunction::Success() { 433 void NetworkingPrivateStartConnectFunction::Success() {
434 SendResponse(true); 434 SendResponse(true);
435 } 435 }
436 436
437 void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) { 437 void NetworkingPrivateStartConnectFunction::Failure(const std::string& error) {
438 error_ = error; 438 error_ = error;
439 SendResponse(false); 439 SendResponse(false);
440 } 440 }
441 441
442 //////////////////////////////////////////////////////////////////////////////// 442 ////////////////////////////////////////////////////////////////////////////////
443 // NetworkingPrivateStartDisconnectFunction 443 // NetworkingPrivateStartDisconnectFunction
444 444
445 NetworkingPrivateStartDisconnectFunction:: 445 NetworkingPrivateStartDisconnectFunction::
446 ~NetworkingPrivateStartDisconnectFunction() { 446 ~NetworkingPrivateStartDisconnectFunction() {
447 } 447 }
448 448
449 bool NetworkingPrivateStartDisconnectFunction::RunAsync() { 449 bool NetworkingPrivateStartDisconnectFunction::RunAsync() {
450 scoped_ptr<private_api::StartDisconnect::Params> params = 450 std::unique_ptr<private_api::StartDisconnect::Params> params =
451 private_api::StartDisconnect::Params::Create(*args_); 451 private_api::StartDisconnect::Params::Create(*args_);
452 EXTENSION_FUNCTION_VALIDATE(params); 452 EXTENSION_FUNCTION_VALIDATE(params);
453 453
454 GetDelegate(browser_context()) 454 GetDelegate(browser_context())
455 ->StartDisconnect( 455 ->StartDisconnect(
456 params->network_guid, 456 params->network_guid,
457 base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this), 457 base::Bind(&NetworkingPrivateStartDisconnectFunction::Success, this),
458 base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this)); 458 base::Bind(&NetworkingPrivateStartDisconnectFunction::Failure, this));
459 return true; 459 return true;
460 } 460 }
461 461
462 void NetworkingPrivateStartDisconnectFunction::Success() { 462 void NetworkingPrivateStartDisconnectFunction::Success() {
463 SendResponse(true); 463 SendResponse(true);
464 } 464 }
465 465
466 void NetworkingPrivateStartDisconnectFunction::Failure( 466 void NetworkingPrivateStartDisconnectFunction::Failure(
467 const std::string& error) { 467 const std::string& error) {
468 error_ = error; 468 error_ = error;
469 SendResponse(false); 469 SendResponse(false);
470 } 470 }
471 471
472 //////////////////////////////////////////////////////////////////////////////// 472 ////////////////////////////////////////////////////////////////////////////////
473 // NetworkingPrivateStartActivateFunction 473 // NetworkingPrivateStartActivateFunction
474 474
475 NetworkingPrivateStartActivateFunction:: 475 NetworkingPrivateStartActivateFunction::
476 ~NetworkingPrivateStartActivateFunction() { 476 ~NetworkingPrivateStartActivateFunction() {
477 } 477 }
478 478
479 bool NetworkingPrivateStartActivateFunction::RunAsync() { 479 bool NetworkingPrivateStartActivateFunction::RunAsync() {
480 scoped_ptr<private_api::StartActivate::Params> params = 480 std::unique_ptr<private_api::StartActivate::Params> params =
481 private_api::StartActivate::Params::Create(*args_); 481 private_api::StartActivate::Params::Create(*args_);
482 EXTENSION_FUNCTION_VALIDATE(params); 482 EXTENSION_FUNCTION_VALIDATE(params);
483 483
484 GetDelegate(browser_context()) 484 GetDelegate(browser_context())
485 ->StartActivate( 485 ->StartActivate(
486 params->network_guid, params->carrier ? *params->carrier : "", 486 params->network_guid, params->carrier ? *params->carrier : "",
487 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this), 487 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this),
488 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this)); 488 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this));
489 return true; 489 return true;
490 } 490 }
491 491
492 void NetworkingPrivateStartActivateFunction::Success() { 492 void NetworkingPrivateStartActivateFunction::Success() {
493 SendResponse(true); 493 SendResponse(true);
494 } 494 }
495 495
496 void NetworkingPrivateStartActivateFunction::Failure(const std::string& error) { 496 void NetworkingPrivateStartActivateFunction::Failure(const std::string& error) {
497 error_ = error; 497 error_ = error;
498 SendResponse(false); 498 SendResponse(false);
499 } 499 }
500 500
501 //////////////////////////////////////////////////////////////////////////////// 501 ////////////////////////////////////////////////////////////////////////////////
502 // NetworkingPrivateVerifyDestinationFunction 502 // NetworkingPrivateVerifyDestinationFunction
503 503
504 NetworkingPrivateVerifyDestinationFunction:: 504 NetworkingPrivateVerifyDestinationFunction::
505 ~NetworkingPrivateVerifyDestinationFunction() { 505 ~NetworkingPrivateVerifyDestinationFunction() {
506 } 506 }
507 507
508 bool NetworkingPrivateVerifyDestinationFunction::RunAsync() { 508 bool NetworkingPrivateVerifyDestinationFunction::RunAsync() {
509 scoped_ptr<private_api::VerifyDestination::Params> params = 509 std::unique_ptr<private_api::VerifyDestination::Params> params =
510 private_api::VerifyDestination::Params::Create(*args_); 510 private_api::VerifyDestination::Params::Create(*args_);
511 EXTENSION_FUNCTION_VALIDATE(params); 511 EXTENSION_FUNCTION_VALIDATE(params);
512 512
513 GetDelegate(browser_context()) 513 GetDelegate(browser_context())
514 ->VerifyDestination( 514 ->VerifyDestination(
515 params->properties, 515 params->properties,
516 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Success, 516 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Success,
517 this), 517 this),
518 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure, 518 base::Bind(&NetworkingPrivateVerifyDestinationFunction::Failure,
519 this)); 519 this));
(...skipping 12 matching lines...) Expand all
532 } 532 }
533 533
534 //////////////////////////////////////////////////////////////////////////////// 534 ////////////////////////////////////////////////////////////////////////////////
535 // NetworkingPrivateVerifyAndEncryptCredentialsFunction 535 // NetworkingPrivateVerifyAndEncryptCredentialsFunction
536 536
537 NetworkingPrivateVerifyAndEncryptCredentialsFunction:: 537 NetworkingPrivateVerifyAndEncryptCredentialsFunction::
538 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() { 538 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() {
539 } 539 }
540 540
541 bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() { 541 bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() {
542 scoped_ptr<private_api::VerifyAndEncryptCredentials::Params> params = 542 std::unique_ptr<private_api::VerifyAndEncryptCredentials::Params> params =
543 private_api::VerifyAndEncryptCredentials::Params::Create(*args_); 543 private_api::VerifyAndEncryptCredentials::Params::Create(*args_);
544 EXTENSION_FUNCTION_VALIDATE(params); 544 EXTENSION_FUNCTION_VALIDATE(params);
545 545
546 GetDelegate(browser_context()) 546 GetDelegate(browser_context())
547 ->VerifyAndEncryptCredentials( 547 ->VerifyAndEncryptCredentials(
548 params->network_guid, params->properties, 548 params->network_guid, params->properties,
549 base::Bind( 549 base::Bind(
550 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success, 550 &NetworkingPrivateVerifyAndEncryptCredentialsFunction::Success,
551 this), 551 this),
552 base::Bind( 552 base::Bind(
(...skipping 15 matching lines...) Expand all
568 } 568 }
569 569
570 //////////////////////////////////////////////////////////////////////////////// 570 ////////////////////////////////////////////////////////////////////////////////
571 // NetworkingPrivateVerifyAndEncryptDataFunction 571 // NetworkingPrivateVerifyAndEncryptDataFunction
572 572
573 NetworkingPrivateVerifyAndEncryptDataFunction:: 573 NetworkingPrivateVerifyAndEncryptDataFunction::
574 ~NetworkingPrivateVerifyAndEncryptDataFunction() { 574 ~NetworkingPrivateVerifyAndEncryptDataFunction() {
575 } 575 }
576 576
577 bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() { 577 bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() {
578 scoped_ptr<private_api::VerifyAndEncryptData::Params> params = 578 std::unique_ptr<private_api::VerifyAndEncryptData::Params> params =
579 private_api::VerifyAndEncryptData::Params::Create(*args_); 579 private_api::VerifyAndEncryptData::Params::Create(*args_);
580 EXTENSION_FUNCTION_VALIDATE(params); 580 EXTENSION_FUNCTION_VALIDATE(params);
581 581
582 GetDelegate(browser_context()) 582 GetDelegate(browser_context())
583 ->VerifyAndEncryptData( 583 ->VerifyAndEncryptData(
584 params->properties, params->data, 584 params->properties, params->data,
585 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Success, 585 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Success,
586 this), 586 this),
587 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure, 587 base::Bind(&NetworkingPrivateVerifyAndEncryptDataFunction::Failure,
588 this)); 588 this));
(...skipping 13 matching lines...) Expand all
602 } 602 }
603 603
604 //////////////////////////////////////////////////////////////////////////////// 604 ////////////////////////////////////////////////////////////////////////////////
605 // NetworkingPrivateSetWifiTDLSEnabledStateFunction 605 // NetworkingPrivateSetWifiTDLSEnabledStateFunction
606 606
607 NetworkingPrivateSetWifiTDLSEnabledStateFunction:: 607 NetworkingPrivateSetWifiTDLSEnabledStateFunction::
608 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() { 608 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() {
609 } 609 }
610 610
611 bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() { 611 bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() {
612 scoped_ptr<private_api::SetWifiTDLSEnabledState::Params> params = 612 std::unique_ptr<private_api::SetWifiTDLSEnabledState::Params> params =
613 private_api::SetWifiTDLSEnabledState::Params::Create(*args_); 613 private_api::SetWifiTDLSEnabledState::Params::Create(*args_);
614 EXTENSION_FUNCTION_VALIDATE(params); 614 EXTENSION_FUNCTION_VALIDATE(params);
615 615
616 GetDelegate(browser_context()) 616 GetDelegate(browser_context())
617 ->SetWifiTDLSEnabledState( 617 ->SetWifiTDLSEnabledState(
618 params->ip_or_mac_address, params->enabled, 618 params->ip_or_mac_address, params->enabled,
619 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success, 619 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Success,
620 this), 620 this),
621 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure, 621 base::Bind(&NetworkingPrivateSetWifiTDLSEnabledStateFunction::Failure,
622 this)); 622 this));
(...skipping 14 matching lines...) Expand all
637 } 637 }
638 638
639 //////////////////////////////////////////////////////////////////////////////// 639 ////////////////////////////////////////////////////////////////////////////////
640 // NetworkingPrivateGetWifiTDLSStatusFunction 640 // NetworkingPrivateGetWifiTDLSStatusFunction
641 641
642 NetworkingPrivateGetWifiTDLSStatusFunction:: 642 NetworkingPrivateGetWifiTDLSStatusFunction::
643 ~NetworkingPrivateGetWifiTDLSStatusFunction() { 643 ~NetworkingPrivateGetWifiTDLSStatusFunction() {
644 } 644 }
645 645
646 bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() { 646 bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() {
647 scoped_ptr<private_api::GetWifiTDLSStatus::Params> params = 647 std::unique_ptr<private_api::GetWifiTDLSStatus::Params> params =
648 private_api::GetWifiTDLSStatus::Params::Create(*args_); 648 private_api::GetWifiTDLSStatus::Params::Create(*args_);
649 EXTENSION_FUNCTION_VALIDATE(params); 649 EXTENSION_FUNCTION_VALIDATE(params);
650 650
651 GetDelegate(browser_context()) 651 GetDelegate(browser_context())
652 ->GetWifiTDLSStatus( 652 ->GetWifiTDLSStatus(
653 params->ip_or_mac_address, 653 params->ip_or_mac_address,
654 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Success, 654 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Success,
655 this), 655 this),
656 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure, 656 base::Bind(&NetworkingPrivateGetWifiTDLSStatusFunction::Failure,
657 this)); 657 this));
(...skipping 14 matching lines...) Expand all
672 } 672 }
673 673
674 //////////////////////////////////////////////////////////////////////////////// 674 ////////////////////////////////////////////////////////////////////////////////
675 // NetworkingPrivateGetCaptivePortalStatusFunction 675 // NetworkingPrivateGetCaptivePortalStatusFunction
676 676
677 NetworkingPrivateGetCaptivePortalStatusFunction:: 677 NetworkingPrivateGetCaptivePortalStatusFunction::
678 ~NetworkingPrivateGetCaptivePortalStatusFunction() { 678 ~NetworkingPrivateGetCaptivePortalStatusFunction() {
679 } 679 }
680 680
681 bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { 681 bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() {
682 scoped_ptr<private_api::GetCaptivePortalStatus::Params> params = 682 std::unique_ptr<private_api::GetCaptivePortalStatus::Params> params =
683 private_api::GetCaptivePortalStatus::Params::Create(*args_); 683 private_api::GetCaptivePortalStatus::Params::Create(*args_);
684 EXTENSION_FUNCTION_VALIDATE(params); 684 EXTENSION_FUNCTION_VALIDATE(params);
685 685
686 GetDelegate(browser_context()) 686 GetDelegate(browser_context())
687 ->GetCaptivePortalStatus( 687 ->GetCaptivePortalStatus(
688 params->network_guid, 688 params->network_guid,
689 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Success, 689 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Success,
690 this), 690 this),
691 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure, 691 base::Bind(&NetworkingPrivateGetCaptivePortalStatusFunction::Failure,
692 this)); 692 this));
(...skipping 13 matching lines...) Expand all
706 SendResponse(false); 706 SendResponse(false);
707 } 707 }
708 708
709 //////////////////////////////////////////////////////////////////////////////// 709 ////////////////////////////////////////////////////////////////////////////////
710 // NetworkingPrivateUnlockCellularSimFunction 710 // NetworkingPrivateUnlockCellularSimFunction
711 711
712 NetworkingPrivateUnlockCellularSimFunction:: 712 NetworkingPrivateUnlockCellularSimFunction::
713 ~NetworkingPrivateUnlockCellularSimFunction() {} 713 ~NetworkingPrivateUnlockCellularSimFunction() {}
714 714
715 bool NetworkingPrivateUnlockCellularSimFunction::RunAsync() { 715 bool NetworkingPrivateUnlockCellularSimFunction::RunAsync() {
716 scoped_ptr<private_api::UnlockCellularSim::Params> params = 716 std::unique_ptr<private_api::UnlockCellularSim::Params> params =
717 private_api::UnlockCellularSim::Params::Create(*args_); 717 private_api::UnlockCellularSim::Params::Create(*args_);
718 EXTENSION_FUNCTION_VALIDATE(params); 718 EXTENSION_FUNCTION_VALIDATE(params);
719 719
720 GetDelegate(browser_context()) 720 GetDelegate(browser_context())
721 ->UnlockCellularSim( 721 ->UnlockCellularSim(
722 params->network_guid, params->pin, params->puk ? *params->puk : "", 722 params->network_guid, params->pin, params->puk ? *params->puk : "",
723 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Success, 723 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Success,
724 this), 724 this),
725 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure, 725 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure,
726 this)); 726 this));
(...skipping 10 matching lines...) Expand all
737 SendResponse(false); 737 SendResponse(false);
738 } 738 }
739 739
740 //////////////////////////////////////////////////////////////////////////////// 740 ////////////////////////////////////////////////////////////////////////////////
741 // NetworkingPrivateSetCellularSimStateFunction 741 // NetworkingPrivateSetCellularSimStateFunction
742 742
743 NetworkingPrivateSetCellularSimStateFunction:: 743 NetworkingPrivateSetCellularSimStateFunction::
744 ~NetworkingPrivateSetCellularSimStateFunction() {} 744 ~NetworkingPrivateSetCellularSimStateFunction() {}
745 745
746 bool NetworkingPrivateSetCellularSimStateFunction::RunAsync() { 746 bool NetworkingPrivateSetCellularSimStateFunction::RunAsync() {
747 scoped_ptr<private_api::SetCellularSimState::Params> params = 747 std::unique_ptr<private_api::SetCellularSimState::Params> params =
748 private_api::SetCellularSimState::Params::Create(*args_); 748 private_api::SetCellularSimState::Params::Create(*args_);
749 EXTENSION_FUNCTION_VALIDATE(params); 749 EXTENSION_FUNCTION_VALIDATE(params);
750 750
751 GetDelegate(browser_context()) 751 GetDelegate(browser_context())
752 ->SetCellularSimState( 752 ->SetCellularSimState(
753 params->network_guid, params->sim_state.require_pin, 753 params->network_guid, params->sim_state.require_pin,
754 params->sim_state.current_pin, 754 params->sim_state.current_pin,
755 params->sim_state.new_pin ? *params->sim_state.new_pin : "", 755 params->sim_state.new_pin ? *params->sim_state.new_pin : "",
756 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Success, 756 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Success,
757 this), 757 this),
758 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Failure, 758 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Failure,
759 this)); 759 this));
760 return true; 760 return true;
761 } 761 }
762 762
763 void NetworkingPrivateSetCellularSimStateFunction::Success() { 763 void NetworkingPrivateSetCellularSimStateFunction::Success() {
764 SendResponse(true); 764 SendResponse(true);
765 } 765 }
766 766
767 void NetworkingPrivateSetCellularSimStateFunction::Failure( 767 void NetworkingPrivateSetCellularSimStateFunction::Failure(
768 const std::string& error) { 768 const std::string& error) {
769 error_ = error; 769 error_ = error;
770 SendResponse(false); 770 SendResponse(false);
771 } 771 }
772 772
773 } // namespace extensions 773 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698