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_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ |
7 | 7 |
8 #include <map> | |
9 #include <string> | 8 #include <string> |
10 #include <vector> | 9 #include <vector> |
11 | 10 |
12 #include "chrome/browser/local_discovery/gcd_base_api_flow.h" | 11 #include "chrome/browser/local_discovery/gcd_base_api_flow.h" |
13 | 12 |
14 namespace local_discovery { | 13 namespace local_discovery { |
15 | 14 |
16 class CloudPrintPrinterList : public GCDBaseApiFlow::Delegate { | 15 class CloudPrintPrinterList : public GCDBaseApiFlow::Delegate { |
17 public: | 16 public: |
18 class Delegate { | 17 class Delegate { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 virtual bool GCDIsCloudPrint() OVERRIDE; | 53 virtual bool GCDIsCloudPrint() OVERRIDE; |
55 | 54 |
56 const PrinterDetails* GetDetailsFor(const std::string& id); | 55 const PrinterDetails* GetDetailsFor(const std::string& id); |
57 | 56 |
58 iterator begin() { return printer_list_.begin(); } | 57 iterator begin() { return printer_list_.begin(); } |
59 iterator end() { return printer_list_.end(); } | 58 iterator end() { return printer_list_.end(); } |
60 | 59 |
61 GCDBaseApiFlow* GetOAuth2ApiFlowForTests() { return &api_flow_; } | 60 GCDBaseApiFlow* GetOAuth2ApiFlowForTests() { return &api_flow_; } |
62 | 61 |
63 private: | 62 private: |
64 typedef std::map<std::string /*ID*/, int /* index in printer_list_ */> | |
65 PrinterIDMap; | |
66 | |
67 bool FillPrinterDetails(const base::DictionaryValue* printer_value, | 63 bool FillPrinterDetails(const base::DictionaryValue* printer_value, |
68 PrinterDetails* printer_details); | 64 PrinterDetails* printer_details); |
69 | 65 |
70 scoped_refptr<net::URLRequestContextGetter> request_context_; | 66 scoped_refptr<net::URLRequestContextGetter> request_context_; |
71 PrinterIDMap printer_id_map_; | |
72 PrinterList printer_list_; | 67 PrinterList printer_list_; |
73 Delegate* delegate_; | 68 Delegate* delegate_; |
74 GCDBaseApiFlow api_flow_; | 69 GCDBaseApiFlow api_flow_; |
75 }; | 70 }; |
76 | 71 |
77 } // namespace local_discovery | 72 } // namespace local_discovery |
78 | 73 |
79 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ | 74 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_PRINTER_LIST_H_ |
OLD | NEW |