OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return_value->SetString(kDictionaryKeyDescription, description.description); | 72 return_value->SetString(kDictionaryKeyDescription, description.description); |
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 (base::ContainsKey(local_ids, i.id)) { |
83 devices_list->Append(CreateDeviceInfo(i)); | 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 (!base::ContainsKey(local_ids, i.id)) { |
89 devices_list->Append(CreateDeviceInfo(i)); | 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), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 current_http_client_->CreateRegisterOperation(GetSyncAccount(), this); | 270 current_http_client_->CreateRegisterOperation(GetSyncAccount(), this); |
271 current_register_operation_->Start(); | 271 current_register_operation_->Start(); |
272 } | 272 } |
273 | 273 |
274 void LocalDiscoveryUIHandler::OnPrivetRegisterClaimToken( | 274 void LocalDiscoveryUIHandler::OnPrivetRegisterClaimToken( |
275 PrivetRegisterOperation* operation, | 275 PrivetRegisterOperation* operation, |
276 const std::string& token, | 276 const std::string& token, |
277 const GURL& url) { | 277 const GURL& url) { |
278 web_ui()->CallJavascriptFunctionUnsafe( | 278 web_ui()->CallJavascriptFunctionUnsafe( |
279 "local_discovery.onRegistrationConfirmedOnPrinter"); | 279 "local_discovery.onRegistrationConfirmedOnPrinter"); |
280 if (!ContainsKey(device_descriptions_, current_http_client_->GetName())) { | 280 if (!base::ContainsKey(device_descriptions_, |
| 281 current_http_client_->GetName())) { |
281 SendRegisterError(); | 282 SendRegisterError(); |
282 return; | 283 return; |
283 } | 284 } |
284 | 285 |
285 confirm_api_call_flow_ = CreateApiFlow(); | 286 confirm_api_call_flow_ = CreateApiFlow(); |
286 if (!confirm_api_call_flow_) { | 287 if (!confirm_api_call_flow_) { |
287 SendRegisterError(); | 288 SendRegisterError(); |
288 return; | 289 return; |
289 } | 290 } |
290 confirm_api_call_flow_->Start(base::WrapUnique<GCDApiFlow::Request>( | 291 confirm_api_call_flow_->Start(base::WrapUnique<GCDApiFlow::Request>( |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 service->RefreshStatusFromService(); | 611 service->RefreshStatusFromService(); |
611 } | 612 } |
612 | 613 |
613 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() { | 614 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() { |
614 return CloudPrintProxyServiceFactory::GetForProfile( | 615 return CloudPrintProxyServiceFactory::GetForProfile( |
615 Profile::FromWebUI(web_ui())); | 616 Profile::FromWebUI(web_ui())); |
616 } | 617 } |
617 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) | 618 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) |
618 | 619 |
619 } // namespace local_discovery | 620 } // namespace local_discovery |
OLD | NEW |