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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_printer_list.h

Issue 2742763002: Clean up Cloud Print API flow code. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/printing/cloud_print/cloud_print_printer_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PRINTER_LIST_H_ 5 #ifndef CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PRINTER_LIST_H_
6 #define CHROME_BROWSER_PRINTING_CLOUD_PRINT_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/printing/cloud_print/gcd_api_flow.h" 12 #include "chrome/browser/printing/cloud_print/gcd_api_flow.h"
13 13
14 namespace cloud_print { 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();
20 ~Device();
21
22 std::string id; 19 std::string id;
23 std::string display_name; 20 std::string display_name;
24 std::string description; 21 std::string description;
25 }; 22 };
26 typedef std::vector<Device> DeviceList; 23 using DeviceList = std::vector<Device>;
27 24
28 class Delegate { 25 class Delegate {
29 public: 26 public:
30 Delegate(); 27 Delegate();
31 virtual ~Delegate(); 28 virtual ~Delegate();
32 29
33 virtual void OnDeviceListReady(const DeviceList& devices) = 0; 30 virtual void OnDeviceListReady(const DeviceList& devices) = 0;
34 virtual void OnDeviceListUnavailable() = 0; 31 virtual void OnDeviceListUnavailable() = 0;
35 }; 32 };
36 33
37 explicit CloudPrintPrinterList(Delegate* delegate); 34 explicit CloudPrintPrinterList(Delegate* delegate);
38 ~CloudPrintPrinterList() override; 35 ~CloudPrintPrinterList() override;
39 36
37 // CloudPrintApiFlowRequest implementation:
40 void OnGCDApiFlowError(GCDApiFlow::Status status) override; 38 void OnGCDApiFlowError(GCDApiFlow::Status status) override;
41
42 void OnGCDApiFlowComplete(const base::DictionaryValue& value) override; 39 void OnGCDApiFlowComplete(const base::DictionaryValue& value) override;
43
44 GURL GetURL() override; 40 GURL GetURL() override;
45 41
46 private: 42 private:
47 bool FillPrinterDetails(const base::DictionaryValue& printer_value, 43 bool FillPrinterDetails(const base::DictionaryValue& printer_value,
48 Device* printer_details); 44 Device* printer_details);
49 45
50 Delegate* delegate_; 46 Delegate* const delegate_;
51 }; 47 };
52 48
53 } // namespace cloud_print 49 } // namespace cloud_print
54 50
55 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PRINTER_LIST_H_ 51 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PRINTER_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/cloud_print/cloud_print_printer_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698