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

Side by Side Diff: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" 5 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return_value->SetString(kDictionaryKeyType, "printer"); 73 return_value->SetString(kDictionaryKeyType, "printer");
74 74
75 return return_value; 75 return return_value;
76 } 76 }
77 77
78 void ReadDevicesList(const CloudPrintPrinterList::DeviceList& devices, 78 void ReadDevicesList(const CloudPrintPrinterList::DeviceList& devices,
79 const std::set<std::string>& local_ids, 79 const std::set<std::string>& local_ids,
80 base::ListValue* devices_list) { 80 base::ListValue* devices_list) {
81 for (const auto& i : devices) { 81 for (const auto& i : devices) {
82 if (ContainsKey(local_ids, i.id)) { 82 if (ContainsKey(local_ids, i.id)) {
83 devices_list->Append(CreateDeviceInfo(i).release()); 83 devices_list->Append(CreateDeviceInfo(i));
84 } 84 }
85 } 85 }
86 86
87 for (const auto& i : devices) { 87 for (const auto& i : devices) {
88 if (!ContainsKey(local_ids, i.id)) { 88 if (!ContainsKey(local_ids, i.id)) {
89 devices_list->Append(CreateDeviceInfo(i).release()); 89 devices_list->Append(CreateDeviceInfo(i));
90 } 90 }
91 } 91 }
92 } 92 }
93 93
94 } // namespace 94 } // namespace
95 95
96 LocalDiscoveryUIHandler::LocalDiscoveryUIHandler() 96 LocalDiscoveryUIHandler::LocalDiscoveryUIHandler()
97 : is_visible_(false), 97 : is_visible_(false),
98 failed_list_count_(0), 98 failed_list_count_(0),
99 succeded_list_count_(0) { 99 succeded_list_count_(0) {
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 service->RefreshStatusFromService(); 610 service->RefreshStatusFromService();
611 } 611 }
612 612
613 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() { 613 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() {
614 return CloudPrintProxyServiceFactory::GetForProfile( 614 return CloudPrintProxyServiceFactory::GetForProfile(
615 Profile::FromWebUI(web_ui())); 615 Profile::FromWebUI(web_ui()));
616 } 616 }
617 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) 617 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE)
618 618
619 } // namespace local_discovery 619 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698