OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 class PrintBackend; | 36 class PrintBackend; |
37 } | 37 } |
38 | 38 |
39 // The handler for Javascript messages related to the print preview dialog. | 39 // The handler for Javascript messages related to the print preview dialog. |
40 class PrintPreviewHandler | 40 class PrintPreviewHandler |
41 : public content::WebUIMessageHandler, | 41 : public content::WebUIMessageHandler, |
42 public ui::SelectFileDialog::Listener, | 42 public ui::SelectFileDialog::Listener, |
43 public printing::PrintViewManagerObserver, | 43 public printing::PrintViewManagerObserver, |
44 #if defined(ENABLE_MDNS) | 44 #if defined(ENABLE_MDNS) |
45 public local_discovery::PrivetLocalPrinterLister::Delegate, | 45 public local_discovery::PrivetLocalPrinterLister::Delegate, |
46 public local_discovery::PrivetCapabilitiesOperation::Delegate | 46 public local_discovery::PrivetCapabilitiesOperation::Delegate, |
| 47 public local_discovery::PrivetLocalPrintOperation::Delegate |
47 #endif | 48 #endif |
48 { | 49 { |
49 public: | 50 public: |
50 PrintPreviewHandler(); | 51 PrintPreviewHandler(); |
51 virtual ~PrintPreviewHandler(); | 52 virtual ~PrintPreviewHandler(); |
52 | 53 |
53 // WebUIMessageHandler implementation. | 54 // WebUIMessageHandler implementation. |
54 virtual void RegisterMessages() OVERRIDE; | 55 virtual void RegisterMessages() OVERRIDE; |
55 | 56 |
56 // SelectFileDialog::Listener implementation. | 57 // SelectFileDialog::Listener implementation. |
(...skipping 27 matching lines...) Expand all Loading... |
84 const std::string& name, | 85 const std::string& name, |
85 const local_discovery::DeviceDescription& description) OVERRIDE; | 86 const local_discovery::DeviceDescription& description) OVERRIDE; |
86 virtual void LocalPrinterRemoved(const std::string& name) OVERRIDE; | 87 virtual void LocalPrinterRemoved(const std::string& name) OVERRIDE; |
87 virtual void LocalPrinterCacheFlushed() OVERRIDE; | 88 virtual void LocalPrinterCacheFlushed() OVERRIDE; |
88 | 89 |
89 // PrivetCapabilitiesOperation::Delegate implementation. | 90 // PrivetCapabilitiesOperation::Delegate implementation. |
90 virtual void OnPrivetCapabilities( | 91 virtual void OnPrivetCapabilities( |
91 local_discovery::PrivetCapabilitiesOperation* capabilities_operation, | 92 local_discovery::PrivetCapabilitiesOperation* capabilities_operation, |
92 int http_error, | 93 int http_error, |
93 const base::DictionaryValue* capabilities) OVERRIDE; | 94 const base::DictionaryValue* capabilities) OVERRIDE; |
| 95 |
| 96 // PrivetLocalPrintOperation::Delegate implementation. |
| 97 virtual void OnPrivetPrintingRequestPDF( |
| 98 const local_discovery::PrivetLocalPrintOperation* |
| 99 print_operation) OVERRIDE; |
| 100 virtual void OnPrivetPrintingRequestPWGRaster( |
| 101 const local_discovery::PrivetLocalPrintOperation* |
| 102 print_operation) OVERRIDE; |
| 103 virtual void OnPrivetPrintingDone( |
| 104 const local_discovery::PrivetLocalPrintOperation* |
| 105 print_operation) OVERRIDE; |
| 106 virtual void OnPrivetPrintingError( |
| 107 const local_discovery::PrivetLocalPrintOperation* print_operation, |
| 108 int http_code) OVERRIDE; |
94 #endif // ENABLE_MDNS | 109 #endif // ENABLE_MDNS |
95 | 110 |
96 | 111 |
97 | 112 |
98 private: | 113 private: |
99 class AccessTokenService; | 114 class AccessTokenService; |
100 struct CUPSPrinterColorModels; | 115 struct CUPSPrinterColorModels; |
101 | 116 |
102 static bool PrivetPrintingEnabled(); | 117 static bool PrivetPrintingEnabled(); |
103 | 118 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 247 |
233 #if defined(USE_CUPS) | 248 #if defined(USE_CUPS) |
234 void SaveCUPSColorSetting(const base::DictionaryValue* settings); | 249 void SaveCUPSColorSetting(const base::DictionaryValue* settings); |
235 | 250 |
236 void ConvertColorSettingToCUPSColorModel( | 251 void ConvertColorSettingToCUPSColorModel( |
237 base::DictionaryValue* settings) const; | 252 base::DictionaryValue* settings) const; |
238 #endif | 253 #endif |
239 | 254 |
240 #if defined(ENABLE_MDNS) | 255 #if defined(ENABLE_MDNS) |
241 void StopPrivetPrinterSearch(); | 256 void StopPrivetPrinterSearch(); |
242 void StartPrivetCapabilities( | 257 void PrivetCapabilitiesUpdateClient( |
243 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); | 258 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); |
| 259 void PrivetLocalPrintUpdateClient( |
| 260 std::string printTicket, |
| 261 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); |
| 262 bool PrivetUpdateClient( |
| 263 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); |
| 264 void StartPrivetLocalPrint(const std::string& print_ticket); |
244 void SendPrivetCapabilitiesError(const std::string& id); | 265 void SendPrivetCapabilitiesError(const std::string& id); |
| 266 void PrintToPrivetPrinter(const std::string& printer_name, |
| 267 const std::string& print_ticket); |
| 268 bool CreatePrivetHTTP( |
| 269 const std::string& name, |
| 270 const local_discovery::PrivetHTTPAsynchronousFactory::ResultCallback& |
| 271 callback); |
245 void FillPrinterDescription( | 272 void FillPrinterDescription( |
246 const std::string& name, | 273 const std::string& name, |
247 const local_discovery::DeviceDescription& description, | 274 const local_discovery::DeviceDescription& description, |
248 base::DictionaryValue* printer_value); | 275 base::DictionaryValue* printer_value); |
249 #endif | 276 #endif |
250 | 277 |
251 // Pointer to current print system. | 278 // Pointer to current print system. |
252 scoped_refptr<printing::PrintBackend> print_backend_; | 279 scoped_refptr<printing::PrintBackend> print_backend_; |
253 | 280 |
254 // The underlying dialog object. | 281 // The underlying dialog object. |
(...skipping 29 matching lines...) Expand all Loading... |
284 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> | 311 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> |
285 service_discovery_client_; | 312 service_discovery_client_; |
286 scoped_ptr<local_discovery::PrivetLocalPrinterLister> printer_lister_; | 313 scoped_ptr<local_discovery::PrivetLocalPrinterLister> printer_lister_; |
287 | 314 |
288 scoped_ptr<local_discovery::PrivetHTTPAsynchronousFactory> | 315 scoped_ptr<local_discovery::PrivetHTTPAsynchronousFactory> |
289 privet_http_factory_; | 316 privet_http_factory_; |
290 scoped_ptr<local_discovery::PrivetHTTPResolution> privet_http_resolution_; | 317 scoped_ptr<local_discovery::PrivetHTTPResolution> privet_http_resolution_; |
291 scoped_ptr<local_discovery::PrivetHTTPClient> privet_http_client_; | 318 scoped_ptr<local_discovery::PrivetHTTPClient> privet_http_client_; |
292 scoped_ptr<local_discovery::PrivetCapabilitiesOperation> | 319 scoped_ptr<local_discovery::PrivetCapabilitiesOperation> |
293 privet_capabilities_operation_; | 320 privet_capabilities_operation_; |
| 321 scoped_ptr<local_discovery::PrivetLocalPrintOperation> |
| 322 privet_local_print_operation_; |
294 #endif | 323 #endif |
295 | 324 |
296 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 325 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
297 | 326 |
298 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 327 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
299 }; | 328 }; |
300 | 329 |
301 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 330 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |