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_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void HandleGetPrinters(const ListValue* args); | 49 void HandleGetPrinters(const ListValue* args); |
50 | 50 |
51 // Ask the initiator renderer to generate a preview. | 51 // Ask the initiator renderer to generate a preview. |
52 // First element of |args| is a job settings JSON string. | 52 // First element of |args| is a job settings JSON string. |
53 void HandleGetPreview(const ListValue* args); | 53 void HandleGetPreview(const ListValue* args); |
54 | 54 |
55 // Get the job settings from Web UI and initiate printing. | 55 // Get the job settings from Web UI and initiate printing. |
56 // First element of |args| is a job settings JSON string. | 56 // First element of |args| is a job settings JSON string. |
57 void HandlePrint(const ListValue* args); | 57 void HandlePrint(const ListValue* args); |
58 | 58 |
| 59 // Handles the request to hide the preview tab for printing. |
| 60 // |args| is unused. |
| 61 void HandleHidePreview(const ListValue* args); |
| 62 |
59 // Get the printer capabilities. | 63 // Get the printer capabilities. |
60 // First element of |args| is the printer name. | 64 // First element of |args| is the printer name. |
61 void HandleGetPrinterCapabilities(const ListValue* args); | 65 void HandleGetPrinterCapabilities(const ListValue* args); |
62 | 66 |
63 // Ask the initiator renderer to show the native print system dialog. | 67 // Ask the initiator renderer to show the native print system dialog. |
64 // |args| is unused. | 68 // |args| is unused. |
65 void HandleShowSystemDialog(const ListValue* args); | 69 void HandleShowSystemDialog(const ListValue* args); |
66 | 70 |
67 // Ask the browser to show the native printer management dialog. | 71 // Ask the browser to show the native printer management dialog. |
68 // |args| is unused. | 72 // |args| is unused. |
(...skipping 18 matching lines...) Expand all Loading... |
87 | 91 |
88 // Helper function to close the print preview tab. | 92 // Helper function to close the print preview tab. |
89 void ClosePrintPreviewTab(); | 93 void ClosePrintPreviewTab(); |
90 | 94 |
91 // Helper function to activate the initiator tab and close the preview tab. | 95 // Helper function to activate the initiator tab and close the preview tab. |
92 void ActivateInitiatorTabAndClosePreviewTab(); | 96 void ActivateInitiatorTabAndClosePreviewTab(); |
93 | 97 |
94 // Adds all the recorded stats taken so far to histogram counts. | 98 // Adds all the recorded stats taken so far to histogram counts. |
95 void ReportStats(); | 99 void ReportStats(); |
96 | 100 |
| 101 // Helper function to hide the preview tab for printing. |
| 102 void HidePreviewTab(); |
| 103 |
| 104 // Helper function to clear initiator tab details for this preview tab. |
| 105 void ClearInitiatorTabDetails(); |
| 106 |
97 // Pointer to current print system. | 107 // Pointer to current print system. |
98 scoped_refptr<printing::PrintBackend> print_backend_; | 108 scoped_refptr<printing::PrintBackend> print_backend_; |
99 | 109 |
100 // The underlying dialog object. | 110 // The underlying dialog object. |
101 scoped_refptr<SelectFileDialog> select_file_dialog_; | 111 scoped_refptr<SelectFileDialog> select_file_dialog_; |
102 | 112 |
103 static FilePath* last_saved_path_; | 113 static FilePath* last_saved_path_; |
104 static std::string* last_used_printer_; | 114 static std::string* last_used_printer_; |
105 | 115 |
106 // A count of how many requests received to regenerate preview data. | 116 // A count of how many requests received to regenerate preview data. |
107 // Initialized to 0 then incremented and emitted to a histogram. | 117 // Initialized to 0 then incremented and emitted to a histogram. |
108 int regenerate_preview_request_count_; | 118 int regenerate_preview_request_count_; |
109 | 119 |
110 // A count of how many requests received to show manage printers dialog. | 120 // A count of how many requests received to show manage printers dialog. |
111 int manage_printers_dialog_request_count_; | 121 int manage_printers_dialog_request_count_; |
112 | 122 |
113 // Whether we have already logged a failed print preview. | 123 // Whether we have already logged a failed print preview. |
114 bool reported_failed_preview_; | 124 bool reported_failed_preview_; |
115 | 125 |
116 // Whether we have already logged the number of printers this session. | 126 // Whether we have already logged the number of printers this session. |
117 bool has_logged_printers_count_; | 127 bool has_logged_printers_count_; |
118 | 128 |
119 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 129 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
120 }; | 130 }; |
121 | 131 |
122 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ | 132 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |