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