| 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/local_discovery/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 local_discovery { |
| 14 | 14 |
| 15 CloudPrintPrinterList::CloudPrintPrinterList(CloudDeviceListDelegate* delegate) | 15 CloudPrintPrinterList::CloudPrintPrinterList(CloudDeviceListDelegate* delegate) |
| 16 : delegate_(delegate) { | 16 : delegate_(delegate) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 CloudPrintPrinterList::~CloudPrintPrinterList() { | 19 CloudPrintPrinterList::~CloudPrintPrinterList() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void CloudPrintPrinterList::OnGCDAPIFlowError(GCDApiFlow::Status status) { | 22 void CloudPrintPrinterList::OnGCDAPIFlowError( |
| 23 GCDApiFlowInterface::Status status) { |
| 23 delegate_->OnDeviceListUnavailable(); | 24 delegate_->OnDeviceListUnavailable(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void CloudPrintPrinterList::OnGCDAPIFlowComplete( | 27 void CloudPrintPrinterList::OnGCDAPIFlowComplete( |
| 27 const base::DictionaryValue& value) { | 28 const base::DictionaryValue& value) { |
| 28 const base::ListValue* printers; | 29 const base::ListValue* printers; |
| 29 | 30 |
| 30 if (!value.GetList(cloud_print::kPrinterListValue, &printers)) { | 31 if (!value.GetList(cloud_print::kPrinterListValue, &printers)) { |
| 31 delegate_->OnDeviceListUnavailable(); | 32 delegate_->OnDeviceListUnavailable(); |
| 32 return; | 33 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Non-essential. | 70 // Non-essential. |
| 70 printer_value.GetString(cloud_print::kPrinterDescValue, | 71 printer_value.GetString(cloud_print::kPrinterDescValue, |
| 71 &printer_details->description); | 72 &printer_details->description); |
| 72 | 73 |
| 73 printer_details->type = CloudDeviceListDelegate::kDeviceTypePrinter; | 74 printer_details->type = CloudDeviceListDelegate::kDeviceTypePrinter; |
| 74 | 75 |
| 75 return true; | 76 return true; |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace local_discovery | 79 } // namespace local_discovery |
| OLD | NEW |