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

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

Issue 284223004: List cloud devices in chrome://devices page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fri 05/16/2014 12:52:36.94 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
(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/gcd_base_api_flow.h"
12
13 namespace local_discovery {
14
15 class CloudDeviceList : public GCDBaseApiFlow::Delegate {
16 public:
17 class Delegate {
18 public:
19 ~Delegate() {}
20
21 virtual void OnCloudDeviceListReady() = 0;
22 virtual void OnCloudDeviceListUnavailable() = 0;
23 };
24
25 struct DeviceDetails {
26 DeviceDetails();
27 ~DeviceDetails();
28
29 std::string id;
30 std::string type;
31 std::string display_name;
32 std::string description;
33 };
34
35 typedef std::vector<DeviceDetails> DeviceList;
36 typedef DeviceList::const_iterator iterator;
37
38 CloudDeviceList(net::URLRequestContextGetter* request_context,
39 OAuth2TokenService* token_service,
40 const std::string& account_id,
41 Delegate* delegate);
42 virtual ~CloudDeviceList();
43
44 void Start();
45
46 virtual void OnGCDAPIFlowError(GCDBaseApiFlow* flow,
47 GCDBaseApiFlow::Status status) OVERRIDE;
48
49 virtual void OnGCDAPIFlowComplete(
50 GCDBaseApiFlow* flow,
51 const base::DictionaryValue* value) OVERRIDE;
52
53 virtual bool GCDIsCloudPrint() OVERRIDE;
54
55 const DeviceDetails* GetDetailsFor(const std::string& id);
56
57 iterator begin() { return device_list_.begin(); }
58 iterator end() { return device_list_.end(); }
59
60 GCDBaseApiFlow* GetOAuth2ApiFlowForTests() { return &api_flow_; }
61
62 private:
63 bool FillDeviceDetails(const base::DictionaryValue* printer_value,
64 DeviceDetails* printer_details);
65
66 scoped_refptr<net::URLRequestContextGetter> request_context_;
67 DeviceList device_list_;
68 Delegate* delegate_;
69 GCDBaseApiFlow api_flow_;
70 };
71
72 } // namespace local_discovery
73
74 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_DEVICE_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698