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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/printing/print_view_manager_observer.h" | 14 #include "chrome/browser/printing/print_view_manager_observer.h" |
15 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 15 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
16 #include "content/public/browser/web_ui_message_handler.h" | 16 #include "content/public/browser/web_ui_message_handler.h" |
17 #include "ui/shell_dialogs/select_file_dialog.h" | 17 #include "ui/shell_dialogs/select_file_dialog.h" |
18 | 18 |
19 #if defined(ENABLE_SERVICE_DISCOVERY) | 19 #if defined(ENABLE_SERVICE_DISCOVERY) |
20 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" | 20 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" |
21 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 21 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
22 #endif // ENABLE_SERVICE_DISCOVERY | 22 #endif // ENABLE_SERVICE_DISCOVERY |
23 | 23 |
24 class ExtensionPrinterHandler; | |
24 class PrinterHandler; | 25 class PrinterHandler; |
25 class PrintPreviewUI; | 26 class PrintPreviewUI; |
26 class PrintSystemTaskProxy; | 27 class PrintSystemTaskProxy; |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class DictionaryValue; | 30 class DictionaryValue; |
30 class RefCountedBytes; | 31 class RefCountedBytes; |
31 } | 32 } |
32 | 33 |
33 namespace content { | 34 namespace content { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 | 116 |
116 static bool PrivetPrintingEnabled(); | 117 static bool PrivetPrintingEnabled(); |
117 | 118 |
118 content::WebContents* preview_web_contents() const; | 119 content::WebContents* preview_web_contents() const; |
119 | 120 |
120 PrintPreviewUI* print_preview_ui() const; | 121 PrintPreviewUI* print_preview_ui() const; |
121 | 122 |
122 // Gets the list of printers. |args| is unused. | 123 // Gets the list of printers. |args| is unused. |
123 void HandleGetPrinters(const base::ListValue* args); | 124 void HandleGetPrinters(const base::ListValue* args); |
124 | 125 |
125 // Starts getting all local privet printers. |arg| is unused. | 126 // Starts getting all local privet printers. |args| is unused. |
126 void HandleGetPrivetPrinters(const base::ListValue* args); | 127 void HandleGetPrivetPrinters(const base::ListValue* args); |
127 | 128 |
128 // Starts getting all local extension managed printers. |arg| is unused. | 129 // Starts getting all local extension managed printers. |args| is unused. |
129 void HandleGetExtensionPrinters(const base::ListValue* args); | 130 void HandleGetExtensionPrinters(const base::ListValue* args); |
130 | 131 |
132 // Starts getting all local USB printers supported by extensions. |args| is | |
133 // unused. | |
134 void HandleGetExtensionUsbPrinters(const base::ListValue* args); | |
135 | |
131 // Stops getting all local privet printers. |arg| is unused. | 136 // Stops getting all local privet printers. |arg| is unused. |
132 void HandleStopGetPrivetPrinters(const base::ListValue* args); | 137 void HandleStopGetPrivetPrinters(const base::ListValue* args); |
133 | 138 |
134 // Asks the initiator renderer to generate a preview. First element of |args| | 139 // Asks the initiator renderer to generate a preview. First element of |args| |
135 // is a job settings JSON string. | 140 // is a job settings JSON string. |
136 void HandleGetPreview(const base::ListValue* args); | 141 void HandleGetPreview(const base::ListValue* args); |
137 | 142 |
138 // Gets the job settings from Web UI and initiate printing. First element of | 143 // Gets the job settings from Web UI and initiate printing. First element of |
139 // |args| is a job settings JSON string. | 144 // |args| is a job settings JSON string. |
140 void HandlePrint(const base::ListValue* args); | 145 void HandlePrint(const base::ListValue* args); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 // Lazily creates |extension_printer_handler_| that can be used to handle | 306 // Lazily creates |extension_printer_handler_| that can be used to handle |
302 // extension printers requests. | 307 // extension printers requests. |
303 void EnsureExtensionPrinterHandlerSet(); | 308 void EnsureExtensionPrinterHandlerSet(); |
304 | 309 |
305 // Called when a list of printers is reported by an extension. | 310 // Called when a list of printers is reported by an extension. |
306 // |printers|: The list of printers managed by the extension. | 311 // |printers|: The list of printers managed by the extension. |
307 // |done|: Whether all the extensions have reported the list of printers | 312 // |done|: Whether all the extensions have reported the list of printers |
308 // they manage. | 313 // they manage. |
309 void OnGotPrintersForExtension(const base::ListValue& printers, bool done); | 314 void OnGotPrintersForExtension(const base::ListValue& printers, bool done); |
310 | 315 |
316 // Called with the list of USB printers supported by extensions. | |
317 // |printers|: The list of printers supported by extensions. | |
318 void OnGotExtensionUsbPrinters(const base::ListValue& printers); | |
319 | |
311 // Called when an extension reports the set of print capabilites for a | 320 // Called when an extension reports the set of print capabilites for a |
312 // printer. | 321 // printer. |
313 // |printer_id|: The id of the printer whose capabilities are reported. | 322 // |printer_id|: The id of the printer whose capabilities are reported. |
314 // |capabilities|: The printer capabilities. | 323 // |capabilities|: The printer capabilities. |
315 void OnGotExtensionPrinterCapabilities( | 324 void OnGotExtensionPrinterCapabilities( |
316 const std::string& printer_id, | 325 const std::string& printer_id, |
317 const base::DictionaryValue& capabilities); | 326 const base::DictionaryValue& capabilities); |
318 | 327 |
319 // Called when an extension print job is completed. | 328 // Called when an extension print job is completed. |
320 // |success|: Whether the job succeeded. | 329 // |success|: Whether the job succeeded. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 scoped_ptr<local_discovery::PrivetHTTPResolution> privet_http_resolution_; | 374 scoped_ptr<local_discovery::PrivetHTTPResolution> privet_http_resolution_; |
366 scoped_ptr<local_discovery::PrivetV1HTTPClient> privet_http_client_; | 375 scoped_ptr<local_discovery::PrivetV1HTTPClient> privet_http_client_; |
367 scoped_ptr<local_discovery::PrivetJSONOperation> | 376 scoped_ptr<local_discovery::PrivetJSONOperation> |
368 privet_capabilities_operation_; | 377 privet_capabilities_operation_; |
369 scoped_ptr<local_discovery::PrivetLocalPrintOperation> | 378 scoped_ptr<local_discovery::PrivetLocalPrintOperation> |
370 privet_local_print_operation_; | 379 privet_local_print_operation_; |
371 #endif | 380 #endif |
372 | 381 |
373 // Handles requests for extension printers. Created lazily by calling | 382 // Handles requests for extension printers. Created lazily by calling |
374 // |EnsureExtensionPrinterHandlerSet|. | 383 // |EnsureExtensionPrinterHandlerSet|. |
375 scoped_ptr<PrinterHandler> extension_printer_handler_; | 384 scoped_ptr<ExtensionPrinterHandler> extension_printer_handler_; |
Vitaly Buka (NO REVIEWS)
2015/05/27 16:58:40
Idea was to have common interface for different pr
Reilly Grant (use Gerrit)
2015/05/28 21:45:00
Done.
| |
376 | 385 |
377 // Notifies tests that want to know if the PDF has been saved. This doesn't | 386 // Notifies tests that want to know if the PDF has been saved. This doesn't |
378 // notify the test if it was a successful save, only that it was attempted. | 387 // notify the test if it was a successful save, only that it was attempted. |
379 base::Closure pdf_file_saved_closure_; | 388 base::Closure pdf_file_saved_closure_; |
380 | 389 |
381 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 390 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
382 | 391 |
383 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 392 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
384 }; | 393 }; |
385 | 394 |
386 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 395 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |