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

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

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 bool NetworkingPrivateGetDeviceStatesFunction::RunSync() { 358 bool NetworkingPrivateGetDeviceStatesFunction::RunSync() {
359 std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList> device_states( 359 std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList> device_states(
360 GetDelegate(browser_context())->GetDeviceStateList()); 360 GetDelegate(browser_context())->GetDeviceStateList());
361 if (!device_states) { 361 if (!device_states) {
362 error_ = networking_private::kErrorNotSupported; 362 error_ = networking_private::kErrorNotSupported;
363 return false; 363 return false;
364 } 364 }
365 365
366 std::unique_ptr<base::ListValue> device_state_list(new base::ListValue); 366 std::unique_ptr<base::ListValue> device_state_list(new base::ListValue);
367 for (const auto& properties : *device_states) 367 for (const auto& properties : *device_states)
368 device_state_list->Append(properties->ToValue().release()); 368 device_state_list->Append(properties->ToValue());
369 SetResult(std::move(device_state_list)); 369 SetResult(std::move(device_state_list));
370 return true; 370 return true;
371 } 371 }
372 372
373 //////////////////////////////////////////////////////////////////////////////// 373 ////////////////////////////////////////////////////////////////////////////////
374 // NetworkingPrivateEnableNetworkTypeFunction 374 // NetworkingPrivateEnableNetworkTypeFunction
375 375
376 NetworkingPrivateEnableNetworkTypeFunction:: 376 NetworkingPrivateEnableNetworkTypeFunction::
377 ~NetworkingPrivateEnableNetworkTypeFunction() { 377 ~NetworkingPrivateEnableNetworkTypeFunction() {
378 } 378 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 SendResponse(true); 766 SendResponse(true);
767 } 767 }
768 768
769 void NetworkingPrivateSetCellularSimStateFunction::Failure( 769 void NetworkingPrivateSetCellularSimStateFunction::Failure(
770 const std::string& error) { 770 const std::string& error) {
771 error_ = error; 771 error_ = error;
772 SendResponse(false); 772 SendResponse(false);
773 } 773 }
774 774
775 } // namespace extensions 775 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698