OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ |
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 virtual void OnAuthFailed() = 0; | 33 virtual void OnAuthFailed() = 0; |
34 protected: | 34 protected: |
35 virtual ~Client() {} | 35 virtual ~Client() {} |
36 }; | 36 }; |
37 | 37 |
38 CloudPrintConnector(Client* client, | 38 CloudPrintConnector(Client* client, |
39 const std::string& proxy_id, | 39 const std::string& proxy_id, |
40 const GURL& cloud_print_server_url, | 40 const GURL& cloud_print_server_url, |
41 const DictionaryValue* print_system_settings); | 41 const DictionaryValue* print_system_settings); |
42 virtual ~CloudPrintConnector(); | |
43 | 42 |
44 bool Start(); | 43 bool Start(); |
45 void Stop(); | 44 void Stop(); |
46 bool IsRunning(); | 45 bool IsRunning(); |
47 | 46 |
48 // Register printer from the list. | 47 // Register printer from the list. |
49 void RegisterPrinters(const printing::PrinterList& printers); | 48 void RegisterPrinters(const printing::PrinterList& printers); |
50 | 49 |
51 // Check for jobs for specific printer. If printer id is empty | 50 // Check for jobs for specific printer. If printer id is empty |
52 // jobs will be checked for all available printers. | 51 // jobs will be checked for all available printers. |
(...skipping 13 matching lines...) Expand all Loading... |
66 | 65 |
67 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( | 66 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( |
68 const content::URLFetcher* source, | 67 const content::URLFetcher* source, |
69 const GURL& url, | 68 const GURL& url, |
70 base::DictionaryValue* json_data, | 69 base::DictionaryValue* json_data, |
71 bool succeeded) OVERRIDE; | 70 bool succeeded) OVERRIDE; |
72 virtual CloudPrintURLFetcher::ResponseAction OnRequestAuthError() OVERRIDE; | 71 virtual CloudPrintURLFetcher::ResponseAction OnRequestAuthError() OVERRIDE; |
73 virtual std::string GetAuthHeader() OVERRIDE; | 72 virtual std::string GetAuthHeader() OVERRIDE; |
74 | 73 |
75 private: | 74 private: |
| 75 friend class base::RefCountedThreadSafe<CloudPrintConnector>; |
| 76 virtual ~CloudPrintConnector(); |
| 77 |
76 // Prototype for a response handler. | 78 // Prototype for a response handler. |
77 typedef CloudPrintURLFetcher::ResponseAction | 79 typedef CloudPrintURLFetcher::ResponseAction |
78 (CloudPrintConnector::*ResponseHandler)( | 80 (CloudPrintConnector::*ResponseHandler)( |
79 const content::URLFetcher* source, | 81 const content::URLFetcher* source, |
80 const GURL& url, | 82 const GURL& url, |
81 DictionaryValue* json_data, | 83 DictionaryValue* json_data, |
82 bool succeeded); | 84 bool succeeded); |
83 | 85 |
84 // Begin response handlers | 86 // Begin response handlers |
85 CloudPrintURLFetcher::ResponseAction HandlePrinterListResponse( | 87 CloudPrintURLFetcher::ResponseAction HandlePrinterListResponse( |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // The CloudPrintURLFetcher instance for the current request. | 181 // The CloudPrintURLFetcher instance for the current request. |
180 scoped_refptr<CloudPrintURLFetcher> request_; | 182 scoped_refptr<CloudPrintURLFetcher> request_; |
181 // The CloudPrintURLFetcher instance for the user message request. | 183 // The CloudPrintURLFetcher instance for the user message request. |
182 scoped_refptr<CloudPrintURLFetcher> user_message_request_; | 184 scoped_refptr<CloudPrintURLFetcher> user_message_request_; |
183 | 185 |
184 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector); | 186 DISALLOW_COPY_AND_ASSIGN(CloudPrintConnector); |
185 }; | 187 }; |
186 | 188 |
187 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ | 189 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ |
188 | 190 |
OLD | NEW |