OLD | NEW |
| (Empty) |
1 // Copyright 2013 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_PRINT_PRINTER_LIST_H_ | |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/values.h" | |
12 #include "chrome/browser/local_discovery/gcd_api_flow.h" | |
13 | |
14 namespace local_discovery { | |
15 | |
16 class CloudPrintPrinterList : public CloudPrintApiFlowRequest { | |
17 public: | |
18 struct Device { | |
19 Device(); | |
20 ~Device(); | |
21 | |
22 std::string id; | |
23 std::string display_name; | |
24 std::string description; | |
25 }; | |
26 typedef std::vector<Device> DeviceList; | |
27 | |
28 class Delegate { | |
29 public: | |
30 Delegate(); | |
31 virtual ~Delegate(); | |
32 | |
33 virtual void OnDeviceListReady(const DeviceList& devices) = 0; | |
34 virtual void OnDeviceListUnavailable() = 0; | |
35 }; | |
36 | |
37 explicit CloudPrintPrinterList(Delegate* delegate); | |
38 ~CloudPrintPrinterList() override; | |
39 | |
40 void OnGCDAPIFlowError(GCDApiFlow::Status status) override; | |
41 | |
42 void OnGCDAPIFlowComplete(const base::DictionaryValue& value) override; | |
43 | |
44 GURL GetURL() override; | |
45 | |
46 private: | |
47 bool FillPrinterDetails(const base::DictionaryValue& printer_value, | |
48 Device* printer_details); | |
49 | |
50 Delegate* delegate_; | |
51 }; | |
52 | |
53 } // namespace local_discovery | |
54 | |
55 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ | |
OLD | NEW |