| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class PrintSystemTaskProxy; | 21 class PrintSystemTaskProxy; |
| 22 class TabContentsWrapper; | 22 class TabContentsWrapper; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class DictionaryValue; | 25 class DictionaryValue; |
| 26 class FundamentalValue; | 26 class FundamentalValue; |
| 27 class StringValue; | 27 class StringValue; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace printing { | 30 namespace printing { |
| 31 struct PageSizeMargins; |
| 31 class PrintBackend; | 32 class PrintBackend; |
| 32 } | 33 } |
| 33 | 34 |
| 34 // The handler for Javascript messages related to the print preview dialog. | 35 // The handler for Javascript messages related to the print preview dialog. |
| 35 class PrintPreviewHandler : public WebUIMessageHandler, | 36 class PrintPreviewHandler : public WebUIMessageHandler, |
| 36 public base::SupportsWeakPtr<PrintPreviewHandler>, | 37 public base::SupportsWeakPtr<PrintPreviewHandler>, |
| 37 public SelectFileDialog::Listener, | 38 public SelectFileDialog::Listener, |
| 38 public printing::PrintViewManagerObserver { | 39 public printing::PrintViewManagerObserver { |
| 39 public: | 40 public: |
| 40 PrintPreviewHandler(); | 41 PrintPreviewHandler(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void HandleClosePreviewTab(const base::ListValue* args); | 134 void HandleClosePreviewTab(const base::ListValue* args); |
| 134 | 135 |
| 135 // Asks the browser for the title of the initiator tab. | 136 // Asks the browser for the title of the initiator tab. |
| 136 // |args| is unused. | 137 // |args| is unused. |
| 137 void HandleGetInitiatorTabTitle(const base::ListValue* args); | 138 void HandleGetInitiatorTabTitle(const base::ListValue* args); |
| 138 | 139 |
| 139 // Asks the browser for the number formatting and measurement system according | 140 // Asks the browser for the number formatting and measurement system according |
| 140 // to the current locale. | 141 // to the current locale. |
| 141 void HandleGetNumberFormatAndMeasurementSystem(const base::ListValue* args); | 142 void HandleGetNumberFormatAndMeasurementSystem(const base::ListValue* args); |
| 142 | 143 |
| 144 // Asks the browser for the last used margin settings. |
| 145 // |args| is unused. |
| 146 void HandleGetLastUsedMarginSettings(const base::ListValue* args); |
| 147 |
| 143 // Sends the printer capabilities to the Web UI. |settings_info| contains | 148 // Sends the printer capabilities to the Web UI. |settings_info| contains |
| 144 // printer capabilities information. | 149 // printer capabilities information. |
| 145 void SendPrinterCapabilities(const base::DictionaryValue& settings_info); | 150 void SendPrinterCapabilities(const base::DictionaryValue& settings_info); |
| 146 | 151 |
| 147 // Sends the default printer to the Web UI. | 152 // Sends the default printer to the Web UI. |
| 148 void SendDefaultPrinter(const base::StringValue& default_printer, | 153 void SendDefaultPrinter(const base::StringValue& default_printer, |
| 149 const base::StringValue& cloud_print_data); | 154 const base::StringValue& cloud_print_data); |
| 150 | 155 |
| 151 // Send the list of printers to the Web UI. | 156 // Send the list of printers to the Web UI. |
| 152 void SetupPrinterList(const base::ListValue& printers); | 157 void SetupPrinterList(const base::ListValue& printers); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 183 scoped_refptr<printing::PrintBackend> print_backend_; | 188 scoped_refptr<printing::PrintBackend> print_backend_; |
| 184 | 189 |
| 185 // The underlying dialog object. | 190 // The underlying dialog object. |
| 186 scoped_refptr<SelectFileDialog> select_file_dialog_; | 191 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 187 | 192 |
| 188 static FilePath* last_saved_path_; | 193 static FilePath* last_saved_path_; |
| 189 static std::string* last_used_printer_cloud_print_data_; | 194 static std::string* last_used_printer_cloud_print_data_; |
| 190 static std::string* last_used_printer_name_; | 195 static std::string* last_used_printer_name_; |
| 191 static printing::ColorModels last_used_color_model_; | 196 static printing::ColorModels last_used_color_model_; |
| 192 static printing::MarginType last_used_margins_type_; | 197 static printing::MarginType last_used_margins_type_; |
| 198 static printing::PageSizeMargins* last_used_page_size_margins_; |
| 193 | 199 |
| 194 // A count of how many requests received to regenerate preview data. | 200 // A count of how many requests received to regenerate preview data. |
| 195 // Initialized to 0 then incremented and emitted to a histogram. | 201 // Initialized to 0 then incremented and emitted to a histogram. |
| 196 int regenerate_preview_request_count_; | 202 int regenerate_preview_request_count_; |
| 197 | 203 |
| 198 // A count of how many requests received to show manage printers dialog. | 204 // A count of how many requests received to show manage printers dialog. |
| 199 int manage_printers_dialog_request_count_; | 205 int manage_printers_dialog_request_count_; |
| 200 | 206 |
| 201 // Whether we have already logged a failed print preview. | 207 // Whether we have already logged a failed print preview. |
| 202 bool reported_failed_preview_; | 208 bool reported_failed_preview_; |
| 203 | 209 |
| 204 // Whether we have already logged the number of printers this session. | 210 // Whether we have already logged the number of printers this session. |
| 205 bool has_logged_printers_count_; | 211 bool has_logged_printers_count_; |
| 206 | 212 |
| 207 // Holds the path to the print to pdf request. It is empty if no such request | 213 // Holds the path to the print to pdf request. It is empty if no such request |
| 208 // exists. | 214 // exists. |
| 209 scoped_ptr<FilePath> print_to_pdf_path_; | 215 scoped_ptr<FilePath> print_to_pdf_path_; |
| 210 | 216 |
| 211 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 217 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
| 212 }; | 218 }; |
| 213 | 219 |
| 214 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ | 220 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
| OLD | NEW |