OLD | NEW |
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 "chrome/browser/local_discovery/cloud_device_list.h" | 5 #include "chrome/browser/local_discovery/cloud_device_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/browser/local_discovery/gcd_constants.h" | 10 #include "chrome/browser/local_discovery/gcd_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 namespace { | 15 namespace { |
16 const char kKindDevicesList[] = "clouddevices#devicesListResponse"; | 16 const char kKindDevicesList[] = "clouddevices#devicesListResponse"; |
17 } | 17 } |
18 | 18 |
19 CloudDeviceList::CloudDeviceList(CloudDeviceListDelegate* delegate) | 19 CloudDeviceList::CloudDeviceList(CloudDeviceListDelegate* delegate) |
20 : delegate_(delegate) { | 20 : delegate_(delegate) { |
21 } | 21 } |
22 | 22 |
23 CloudDeviceList::~CloudDeviceList() { | 23 CloudDeviceList::~CloudDeviceList() { |
24 } | 24 } |
25 | 25 |
26 void CloudDeviceList::OnGCDAPIFlowError(GCDApiFlow::Status status) { | 26 void CloudDeviceList::OnGCDAPIFlowError(GCDApiFlowInterface::Status status) { |
27 delegate_->OnDeviceListUnavailable(); | 27 delegate_->OnDeviceListUnavailable(); |
28 } | 28 } |
29 | 29 |
30 void CloudDeviceList::OnGCDAPIFlowComplete(const base::DictionaryValue& value) { | 30 void CloudDeviceList::OnGCDAPIFlowComplete(const base::DictionaryValue& value) { |
31 std::string kind; | 31 std::string kind; |
32 value.GetString(kGCDKeyKind, &kind); | 32 value.GetString(kGCDKeyKind, &kind); |
33 | 33 |
34 const base::ListValue* devices = NULL; | 34 const base::ListValue* devices = NULL; |
35 if (kind != kKindDevicesList || !value.GetList("devices", &devices)) { | 35 if (kind != kKindDevicesList || !value.GetList("devices", &devices)) { |
36 delegate_->OnDeviceListUnavailable(); | 36 delegate_->OnDeviceListUnavailable(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (!device_value.GetString("deviceKind", &details->type)) | 73 if (!device_value.GetString("deviceKind", &details->type)) |
74 return false; | 74 return false; |
75 | 75 |
76 // Non-essential. | 76 // Non-essential. |
77 device_value.GetString("description", &details->description); | 77 device_value.GetString("description", &details->description); |
78 | 78 |
79 return true; | 79 return true; |
80 } | 80 } |
81 | 81 |
82 } // namespace local_discovery | 82 } // namespace local_discovery |
OLD | NEW |