OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "chrome/browser/local_discovery/cloud_device_list_delegate.h" |
| 12 #include "chrome/browser/local_discovery/gcd_base_api_flow.h" |
| 13 |
| 14 namespace local_discovery { |
| 15 |
| 16 class CloudDeviceList : public GCDBaseApiFlow::Delegate { |
| 17 public: |
| 18 typedef std::vector<CloudDeviceListDelegate::Device> DeviceList; |
| 19 typedef DeviceList::const_iterator iterator; |
| 20 |
| 21 CloudDeviceList(net::URLRequestContextGetter* request_context, |
| 22 OAuth2TokenService* token_service, |
| 23 const std::string& account_id, |
| 24 CloudDeviceListDelegate* delegate); |
| 25 virtual ~CloudDeviceList(); |
| 26 |
| 27 void Start(); |
| 28 |
| 29 virtual void OnGCDAPIFlowError(GCDBaseApiFlow* flow, |
| 30 GCDBaseApiFlow::Status status) OVERRIDE; |
| 31 |
| 32 virtual void OnGCDAPIFlowComplete( |
| 33 GCDBaseApiFlow* flow, |
| 34 const base::DictionaryValue* value) OVERRIDE; |
| 35 |
| 36 virtual bool GCDIsCloudPrint() OVERRIDE; |
| 37 |
| 38 GCDBaseApiFlow* GetOAuth2ApiFlowForTests() { return &api_flow_; } |
| 39 |
| 40 const DeviceList& device_list() const { |
| 41 return device_list_; |
| 42 } |
| 43 |
| 44 private: |
| 45 bool FillDeviceDetails(const base::DictionaryValue* value, |
| 46 CloudDeviceListDelegate::Device* device); |
| 47 |
| 48 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 49 DeviceList device_list_; |
| 50 CloudDeviceListDelegate* delegate_; |
| 51 GCDBaseApiFlow api_flow_; |
| 52 }; |
| 53 |
| 54 } // namespace local_discovery |
| 55 |
| 56 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_ |
OLD | NEW |