| 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_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void SetPrintPreviewDataForIndex(int index, | 46 void SetPrintPreviewDataForIndex(int index, |
| 47 const base::RefCountedBytes* data); | 47 const base::RefCountedBytes* data); |
| 48 | 48 |
| 49 // Clear the existing print preview data. | 49 // Clear the existing print preview data. |
| 50 void ClearAllPreviewData(); | 50 void ClearAllPreviewData(); |
| 51 | 51 |
| 52 // Returns the available draft page count. | 52 // Returns the available draft page count. |
| 53 int GetAvailableDraftPageCount(); | 53 int GetAvailableDraftPageCount(); |
| 54 | 54 |
| 55 // Setters | 55 // Setters |
| 56 void SetInitiatorTitle(const string16& initiator_title); | 56 void SetInitiatorTabTitle(const string16& initiator_tab_title); |
| 57 | 57 |
| 58 string16 initiator_title() { return initiator_title_; } | 58 string16 initiator_tab_title() { return initiator_tab_title_; } |
| 59 | 59 |
| 60 bool source_is_modifiable() { return source_is_modifiable_; } | 60 bool source_is_modifiable() { return source_is_modifiable_; } |
| 61 | 61 |
| 62 bool source_has_selection() { return source_has_selection_; } | 62 bool source_has_selection() { return source_has_selection_; } |
| 63 | 63 |
| 64 bool print_selection_only() { return print_selection_only_; } | 64 bool print_selection_only() { return print_selection_only_; } |
| 65 | 65 |
| 66 // Set initial settings for PrintPreviewUI. | 66 // Set initial settings for PrintPreviewUI. |
| 67 static void SetInitialParams( | 67 static void SetInitialParams( |
| 68 content::WebContents* print_preview_dialog, | 68 content::WebContents* print_preview_dialog, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // |expected_pages_count| specifies the total number of pages. | 102 // |expected_pages_count| specifies the total number of pages. |
| 103 // |preview_request_id| indicates which request resulted in this response. | 103 // |preview_request_id| indicates which request resulted in this response. |
| 104 void OnPreviewDataIsAvailable(int expected_pages_count, | 104 void OnPreviewDataIsAvailable(int expected_pages_count, |
| 105 int preview_request_id); | 105 int preview_request_id); |
| 106 | 106 |
| 107 // Notifies the Web UI renderer to reuse the preview data. | 107 // Notifies the Web UI renderer to reuse the preview data. |
| 108 // |preview_request_id| indicates which request resulted in this response. | 108 // |preview_request_id| indicates which request resulted in this response. |
| 109 void OnReusePreviewData(int preview_request_id); | 109 void OnReusePreviewData(int preview_request_id); |
| 110 | 110 |
| 111 // Notifies the Web UI that preview dialog has been destroyed. This is the | 111 // Notifies the Web UI that preview dialog has been destroyed. This is the |
| 112 // last chance to communicate with the initiator before the association is | 112 // last chance to communicate with the initiator tab before the association |
| 113 // erased. | 113 // is erased. |
| 114 void OnPrintPreviewDialogDestroyed(); | 114 void OnPrintPreviewDialogDestroyed(); |
| 115 | 115 |
| 116 // Notifies the Web UI that the print preview failed to render. | 116 // Notifies the Web UI that the print preview failed to render. |
| 117 void OnPrintPreviewFailed(); | 117 void OnPrintPreviewFailed(); |
| 118 | 118 |
| 119 // Notified the Web UI that this print preview dialog's RenderProcess has been | 119 // Notified the Web UI that this print preview dialog's RenderProcess has been |
| 120 // closed, which may occur for several reasons, e.g. tab closure or crash. | 120 // closed, which may occur for several reasons, e.g. tab closure or crash. |
| 121 void OnPrintPreviewDialogClosed(); | 121 void OnPrintPreviewDialogClosed(); |
| 122 | 122 |
| 123 // Notifies the Web UI that initiator is closed, so we can disable all the | 123 // Notifies the Web UI that initiator tab is closed, so we can disable all the |
| 124 // controls that need the initiator for generating the preview data. | 124 // controls that need the initiator tab for generating the preview data. |
| 125 void OnInitiatorClosed(); | 125 void OnInitiatorTabClosed(); |
| 126 | 126 |
| 127 // Notifies the Web UI renderer that file selection has been cancelled. | 127 // Notifies the Web UI renderer that file selection has been cancelled. |
| 128 void OnFileSelectionCancelled(); | 128 void OnFileSelectionCancelled(); |
| 129 | 129 |
| 130 // Notifies the Web UI that the printer is unavailable or its settings are | 130 // Notifies the Web UI that the printer is unavailable or its settings are |
| 131 // invalid. | 131 // invalid. |
| 132 void OnInvalidPrinterSettings(); | 132 void OnInvalidPrinterSettings(); |
| 133 | 133 |
| 134 // Notifies the Web UI to cancel the pending preview request. | 134 // Notifies the Web UI to cancel the pending preview request. |
| 135 void OnCancelPendingPreviewRequest(); | 135 void OnCancelPendingPreviewRequest(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 // Indicates whether the source document can be modified. | 175 // Indicates whether the source document can be modified. |
| 176 bool source_is_modifiable_; | 176 bool source_is_modifiable_; |
| 177 | 177 |
| 178 // Indicates whether the source document has selection. | 178 // Indicates whether the source document has selection. |
| 179 bool source_has_selection_; | 179 bool source_has_selection_; |
| 180 | 180 |
| 181 // Indicates whether only the selection should be printed. | 181 // Indicates whether only the selection should be printed. |
| 182 bool print_selection_only_; | 182 bool print_selection_only_; |
| 183 | 183 |
| 184 // Store the initiator title, used for populating the print preview dialog | 184 // Store the initiator tab title, used for populating the print preview dialog |
| 185 // title. | 185 // title. |
| 186 string16 initiator_title_; | 186 string16 initiator_tab_title_; |
| 187 | 187 |
| 188 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 188 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
| 189 bool dialog_closed_; | 189 bool dialog_closed_; |
| 190 | 190 |
| 191 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 191 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 194 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |