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 24 matching lines...) Expand all Loading... |
35 struct PageSizeMargins; | 35 struct PageSizeMargins; |
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 #if defined(ENABLE_MDNS) | 42 #if defined(ENABLE_MDNS) |
43 public local_discovery::PrivetLocalPrinterLister::Delegate, | 43 public local_discovery::PrivetLocalPrinterLister::Delegate, |
44 public local_discovery::PrivetCapabilitiesOperation::Delegate, | 44 public local_discovery::PrivetCapabilitiesOperation::Delegate, |
| 45 public local_discovery::PrivetLocalPrintOperation::Delegate, |
45 #endif | 46 #endif |
46 public ui::SelectFileDialog::Listener, | 47 public ui::SelectFileDialog::Listener, |
47 public printing::PrintViewManagerObserver | 48 public printing::PrintViewManagerObserver |
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; |
(...skipping 29 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 private: | 111 private: |
97 class AccessTokenService; | 112 class AccessTokenService; |
98 struct CUPSPrinterColorModels; | 113 struct CUPSPrinterColorModels; |
99 | 114 |
100 static bool PrivetPrintingEnabled(); | 115 static bool PrivetPrintingEnabled(); |
101 | 116 |
102 content::WebContents* preview_web_contents() const; | 117 content::WebContents* preview_web_contents() const; |
103 | 118 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 245 |
231 #if defined(USE_CUPS) | 246 #if defined(USE_CUPS) |
232 void SaveCUPSColorSetting(const base::DictionaryValue* settings); | 247 void SaveCUPSColorSetting(const base::DictionaryValue* settings); |
233 | 248 |
234 void ConvertColorSettingToCUPSColorModel( | 249 void ConvertColorSettingToCUPSColorModel( |
235 base::DictionaryValue* settings) const; | 250 base::DictionaryValue* settings) const; |
236 #endif | 251 #endif |
237 | 252 |
238 #if defined(ENABLE_MDNS) | 253 #if defined(ENABLE_MDNS) |
239 void StopPrivetPrinterSearch(); | 254 void StopPrivetPrinterSearch(); |
240 void StartPrivetCapabilities( | 255 void PrivetCapabilitiesUpdateClient( |
241 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); | 256 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); |
| 257 void PrivetLocalPrintUpdateClient( |
| 258 std::string printTicket, |
| 259 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); |
| 260 bool PrivetUpdateClient( |
| 261 scoped_ptr<local_discovery::PrivetHTTPClient> http_client); |
| 262 void StartPrivetLocalPrint(const std::string& print_ticket); |
242 void SendPrivetCapabilitiesError(const std::string& id); | 263 void SendPrivetCapabilitiesError(const std::string& id); |
| 264 void PrintToPrivetPrinter(const std::string& printer_name, |
| 265 const std::string& print_ticket); |
| 266 bool CreatePrivetHTTP( |
| 267 const std::string& name, |
| 268 const local_discovery::PrivetHTTPAsynchronousFactory::ResultCallback& |
| 269 callback); |
243 void FillPrinterDescription( | 270 void FillPrinterDescription( |
244 const std::string& name, | 271 const std::string& name, |
245 const local_discovery::DeviceDescription& description, | 272 const local_discovery::DeviceDescription& description, |
246 base::DictionaryValue* printer_value); | 273 base::DictionaryValue* printer_value); |
247 #endif | 274 #endif |
248 | 275 |
249 // Pointer to current print system. | 276 // Pointer to current print system. |
250 scoped_refptr<printing::PrintBackend> print_backend_; | 277 scoped_refptr<printing::PrintBackend> print_backend_; |
251 | 278 |
252 // The underlying dialog object. | 279 // The underlying dialog object. |
(...skipping 29 matching lines...) Expand all Loading... |
282 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> | 309 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> |
283 service_discovery_client_; | 310 service_discovery_client_; |
284 scoped_ptr<local_discovery::PrivetLocalPrinterLister> printer_lister_; | 311 scoped_ptr<local_discovery::PrivetLocalPrinterLister> printer_lister_; |
285 | 312 |
286 scoped_ptr<local_discovery::PrivetHTTPAsynchronousFactory> | 313 scoped_ptr<local_discovery::PrivetHTTPAsynchronousFactory> |
287 privet_http_factory_; | 314 privet_http_factory_; |
288 scoped_ptr<local_discovery::PrivetHTTPResolution> privet_http_resolution_; | 315 scoped_ptr<local_discovery::PrivetHTTPResolution> privet_http_resolution_; |
289 scoped_ptr<local_discovery::PrivetHTTPClient> privet_http_client_; | 316 scoped_ptr<local_discovery::PrivetHTTPClient> privet_http_client_; |
290 scoped_ptr<local_discovery::PrivetCapabilitiesOperation> | 317 scoped_ptr<local_discovery::PrivetCapabilitiesOperation> |
291 privet_capabilities_operation_; | 318 privet_capabilities_operation_; |
| 319 scoped_ptr<local_discovery::PrivetLocalPrintOperation> |
| 320 privet_local_print_operation_; |
292 #endif | 321 #endif |
293 | 322 |
294 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 323 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
295 | 324 |
296 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 325 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
297 }; | 326 }; |
298 | 327 |
299 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 328 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |