Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 int http_code) override; | 109 int http_code) override; |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 int regenerate_preview_request_count() const { | 112 int regenerate_preview_request_count() const { |
| 113 return regenerate_preview_request_count_; | 113 return regenerate_preview_request_count_; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Sets |pdf_file_saved_closure_| to |closure|. | 116 // Sets |pdf_file_saved_closure_| to |closure|. |
| 117 void SetPdfSavedClosureForTesting(const base::Closure& closure); | 117 void SetPdfSavedClosureForTesting(const base::Closure& closure); |
| 118 | 118 |
| 119 // Handles the request to cancel the pending print request. |args| is unused. | |
| 120 void HandleCancelPendingPrintRequest(const base::ListValue* args); | |
|
Lei Zhang
2017/07/11 22:34:20
Can we keep this methods protected, and add a new
rbpotter
2017/07/12 00:26:35
Done.
| |
| 121 | |
| 119 protected: | 122 protected: |
| 120 // If |prompt_user| is true, starts a task to create the default Save As PDF | 123 // If |prompt_user| is true, starts a task to create the default Save As PDF |
| 121 // directory if needed. OnDirectoryCreated() will be called when it | 124 // directory if needed. OnDirectoryCreated() will be called when it |
| 122 // finishes to open the modal dialog and prompt the user. Otherwise, just | 125 // finishes to open the modal dialog and prompt the user. Otherwise, just |
| 123 // accept |default_path| and uniquify it. | 126 // accept |default_path| and uniquify it. |
| 124 // Protected so unit tests can access. | 127 // Protected so unit tests can access. |
| 125 virtual void SelectFile(const base::FilePath& default_path, bool prompt_user); | 128 virtual void SelectFile(const base::FilePath& default_path, bool prompt_user); |
| 126 | 129 |
| 127 // Handles printing to PDF. Protected to expose to unit tests. | 130 // Handles printing to PDF. Protected to expose to unit tests. |
| 128 void PrintToPdf(); | 131 void PrintToPdf(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 void HandleGetPreview(const base::ListValue* args); | 163 void HandleGetPreview(const base::ListValue* args); |
| 161 | 164 |
| 162 // Gets the job settings from Web UI and initiate printing. First element of | 165 // Gets the job settings from Web UI and initiate printing. First element of |
| 163 // |args| is a job settings JSON string. | 166 // |args| is a job settings JSON string. |
| 164 void HandlePrint(const base::ListValue* args); | 167 void HandlePrint(const base::ListValue* args); |
| 165 | 168 |
| 166 // Handles the request to hide the preview dialog for printing. | 169 // Handles the request to hide the preview dialog for printing. |
| 167 // |args| is unused. | 170 // |args| is unused. |
| 168 void HandleHidePreview(const base::ListValue* args); | 171 void HandleHidePreview(const base::ListValue* args); |
| 169 | 172 |
| 170 // Handles the request to cancel the pending print request. |args| is unused. | |
| 171 void HandleCancelPendingPrintRequest(const base::ListValue* args); | |
| 172 | |
| 173 // Handles a request to store data that the web ui wishes to persist. | 173 // Handles a request to store data that the web ui wishes to persist. |
| 174 // First element of |args| is the data to persist. | 174 // First element of |args| is the data to persist. |
| 175 void HandleSaveAppState(const base::ListValue* args); | 175 void HandleSaveAppState(const base::ListValue* args); |
| 176 | 176 |
| 177 // Gets the printer capabilities. First element of |args| is the printer name. | 177 // Gets the printer capabilities. First element of |args| is the printer name. |
| 178 void HandleGetPrinterCapabilities(const base::ListValue* args); | 178 void HandleGetPrinterCapabilities(const base::ListValue* args); |
| 179 | 179 |
| 180 // Performs printer setup. First element of |args| is the printer name. | 180 // Performs printer setup. First element of |args| is the printer name. |
| 181 void HandlePrinterSetup(const base::ListValue* args); | 181 void HandlePrinterSetup(const base::ListValue* args); |
| 182 | 182 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 // Proxy for calls to the print backend. Lazily initialized since web_ui() is | 451 // Proxy for calls to the print backend. Lazily initialized since web_ui() is |
| 452 // not available at construction time. | 452 // not available at construction time. |
| 453 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; | 453 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; |
| 454 | 454 |
| 455 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 455 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
| 456 | 456 |
| 457 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 457 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
| 458 }; | 458 }; |
| 459 | 459 |
| 460 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 460 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
| OLD | NEW |