| Index: chrome/browser/local_discovery/cloud_device_list.h
|
| diff --git a/chrome/browser/local_discovery/cloud_device_list.h b/chrome/browser/local_discovery/cloud_device_list.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6be2088ca461165726f0cc3a7d6b277b202f8e04
|
| --- /dev/null
|
| +++ b/chrome/browser/local_discovery/cloud_device_list.h
|
| @@ -0,0 +1,74 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_
|
| +#define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "chrome/browser/local_discovery/gcd_base_api_flow.h"
|
| +
|
| +namespace local_discovery {
|
| +
|
| +class CloudDeviceList : public GCDBaseApiFlow::Delegate {
|
| + public:
|
| + class Delegate {
|
| + public:
|
| + ~Delegate() {}
|
| +
|
| + virtual void OnCloudDeviceListReady() = 0;
|
| + virtual void OnCloudDeviceListUnavailable() = 0;
|
| + };
|
| +
|
| + struct DeviceDetails {
|
| + DeviceDetails();
|
| + ~DeviceDetails();
|
| +
|
| + std::string id;
|
| + std::string type;
|
| + std::string display_name;
|
| + std::string description;
|
| + };
|
| +
|
| + typedef std::vector<DeviceDetails> DeviceList;
|
| + typedef DeviceList::const_iterator iterator;
|
| +
|
| + CloudDeviceList(net::URLRequestContextGetter* request_context,
|
| + OAuth2TokenService* token_service,
|
| + const std::string& account_id,
|
| + Delegate* delegate);
|
| + virtual ~CloudDeviceList();
|
| +
|
| + void Start();
|
| +
|
| + virtual void OnGCDAPIFlowError(GCDBaseApiFlow* flow,
|
| + GCDBaseApiFlow::Status status) OVERRIDE;
|
| +
|
| + virtual void OnGCDAPIFlowComplete(
|
| + GCDBaseApiFlow* flow,
|
| + const base::DictionaryValue* value) OVERRIDE;
|
| +
|
| + virtual bool GCDIsCloudPrint() OVERRIDE;
|
| +
|
| + const DeviceDetails* GetDetailsFor(const std::string& id);
|
| +
|
| + iterator begin() { return device_list_.begin(); }
|
| + iterator end() { return device_list_.end(); }
|
| +
|
| + GCDBaseApiFlow* GetOAuth2ApiFlowForTests() { return &api_flow_; }
|
| +
|
| + private:
|
| + bool FillDeviceDetails(const base::DictionaryValue* printer_value,
|
| + DeviceDetails* printer_details);
|
| +
|
| + scoped_refptr<net::URLRequestContextGetter> request_context_;
|
| + DeviceList device_list_;
|
| + Delegate* delegate_;
|
| + GCDBaseApiFlow api_flow_;
|
| +};
|
| +
|
| +} // namespace local_discovery
|
| +
|
| +#endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_
|
|
|