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/local_discovery/cloud_print_printer_list.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_printer_list.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/common/cloud_print/cloud_print_constants.h" | 10 #include "chrome/common/cloud_print/cloud_print_constants.h" |
11 #include "components/cloud_devices/common/cloud_devices_urls.h" | 11 #include "components/cloud_devices/common/cloud_devices_urls.h" |
12 | 12 |
13 namespace local_discovery { | 13 namespace cloud_print { |
14 | 14 |
15 CloudPrintPrinterList::Device::Device() {} | 15 CloudPrintPrinterList::Device::Device() {} |
16 | 16 |
17 CloudPrintPrinterList::Device::~Device() {} | 17 CloudPrintPrinterList::Device::~Device() {} |
18 | 18 |
19 CloudPrintPrinterList::Delegate::Delegate() {} | 19 CloudPrintPrinterList::Delegate::Delegate() {} |
20 | 20 |
21 CloudPrintPrinterList::Delegate::~Delegate() {} | 21 CloudPrintPrinterList::Delegate::~Delegate() {} |
22 | 22 |
23 CloudPrintPrinterList::CloudPrintPrinterList(Delegate* delegate) | 23 CloudPrintPrinterList::CloudPrintPrinterList(Delegate* delegate) |
24 : delegate_(delegate) {} | 24 : delegate_(delegate) {} |
25 | 25 |
26 CloudPrintPrinterList::~CloudPrintPrinterList() { | 26 CloudPrintPrinterList::~CloudPrintPrinterList() { |
27 } | 27 } |
28 | 28 |
29 void CloudPrintPrinterList::OnGCDAPIFlowError(GCDApiFlow::Status status) { | 29 void CloudPrintPrinterList::OnGCDApiFlowError(GCDApiFlow::Status status) { |
30 delegate_->OnDeviceListUnavailable(); | 30 delegate_->OnDeviceListUnavailable(); |
31 } | 31 } |
32 | 32 |
33 void CloudPrintPrinterList::OnGCDAPIFlowComplete( | 33 void CloudPrintPrinterList::OnGCDApiFlowComplete( |
34 const base::DictionaryValue& value) { | 34 const base::DictionaryValue& value) { |
35 const base::ListValue* printers; | 35 const base::ListValue* printers; |
36 | 36 |
37 if (!value.GetList(cloud_print::kPrinterListValue, &printers)) { | 37 if (!value.GetList(cloud_print::kPrinterListValue, &printers)) { |
38 delegate_->OnDeviceListUnavailable(); | 38 delegate_->OnDeviceListUnavailable(); |
39 return; | 39 return; |
40 } | 40 } |
41 | 41 |
42 DeviceList devices; | 42 DeviceList devices; |
43 for (base::ListValue::const_iterator i = printers->begin(); | 43 for (base::ListValue::const_iterator i = printers->begin(); |
(...skipping 29 matching lines...) Expand all Loading... |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 // Non-essential. | 76 // Non-essential. |
77 printer_value.GetString(cloud_print::kPrinterDescValue, | 77 printer_value.GetString(cloud_print::kPrinterDescValue, |
78 &printer_details->description); | 78 &printer_details->description); |
79 | 79 |
80 return true; | 80 return true; |
81 } | 81 } |
82 | 82 |
83 } // namespace local_discovery | 83 } // namespace cloud_print |
OLD | NEW |