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

Side by Side Diff: chrome/browser/local_discovery/cloud_device_list.cc

Issue 298883012: Added GetURL, GetOAuthScope, GetExtraRequestHeaders into GCDBaseApiFlow::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "components/cloud_devices/common/cloud_devices_urls.h" 10 #include "components/cloud_devices/common/cloud_devices_urls.h"
11 11
12 namespace local_discovery { 12 namespace local_discovery {
13 13
14 CloudDeviceList::CloudDeviceList(net::URLRequestContextGetter* request_context, 14 CloudDeviceList::CloudDeviceList(net::URLRequestContextGetter* request_context,
15 OAuth2TokenService* token_service, 15 OAuth2TokenService* token_service,
16 const std::string& account_id, 16 const std::string& account_id,
17 CloudDeviceListDelegate* delegate) 17 CloudDeviceListDelegate* delegate)
18 : request_context_(request_context), 18 : delegate_(delegate),
19 delegate_(delegate), 19 api_flow_(request_context,
20 api_flow_(request_context_,
21 token_service, 20 token_service,
22 account_id, 21 account_id,
23 cloud_devices::GetCloudDevicesRelativeURL("devices"),
24 this) { 22 this) {
25 } 23 }
26 24
27 CloudDeviceList::~CloudDeviceList() { 25 CloudDeviceList::~CloudDeviceList() {
28 } 26 }
29 27
30 void CloudDeviceList::Start() { 28 void CloudDeviceList::Start() {
31 api_flow_.Start(); 29 api_flow_.Start();
32 } 30 }
33 31
(...skipping 21 matching lines...) Expand all
55 53
56 if (!FillDeviceDetails(device, &details)) 54 if (!FillDeviceDetails(device, &details))
57 continue; 55 continue;
58 56
59 device_list_.push_back(details); 57 device_list_.push_back(details);
60 } 58 }
61 59
62 delegate_->OnDeviceListReady(); 60 delegate_->OnDeviceListReady();
63 } 61 }
64 62
65 bool CloudDeviceList::GCDIsCloudPrint() { 63 GURL CloudDeviceList::GetURL() {
66 return false; 64 return cloud_devices::GetCloudDevicesRelativeURL("devices");
67 } 65 }
68 66
69 bool CloudDeviceList::FillDeviceDetails( 67 bool CloudDeviceList::FillDeviceDetails(
70 const base::DictionaryValue* device_value, 68 const base::DictionaryValue* device_value,
71 CloudDeviceListDelegate::Device* details) { 69 CloudDeviceListDelegate::Device* details) {
72 if (!device_value->GetString("id", &details->id)) 70 if (!device_value->GetString("id", &details->id))
73 return false; 71 return false;
74 72
75 if (!device_value->GetString("displayName", &details->display_name) && 73 if (!device_value->GetString("displayName", &details->display_name) &&
76 !device_value->GetString("systemName", &details->display_name)) { 74 !device_value->GetString("systemName", &details->display_name)) {
77 return false; 75 return false;
78 } 76 }
79 77
80 if (!device_value->GetString("deviceKind", &details->type)) 78 if (!device_value->GetString("deviceKind", &details->type))
81 return false; 79 return false;
82 80
83 // Non-essential. 81 // Non-essential.
84 device_value->GetString("description", &details->description); 82 device_value->GetString("description", &details->description);
85 83
86 return true; 84 return true;
87 } 85 }
88 86
89 } // namespace local_discovery 87 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/cloud_device_list.h ('k') | chrome/browser/local_discovery/cloud_print_printer_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698