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_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Returns the available draft page count. | 44 // Returns the available draft page count. |
45 int GetAvailableDraftPageCount(); | 45 int GetAvailableDraftPageCount(); |
46 | 46 |
47 // Setters | 47 // Setters |
48 void SetInitiatorTabURLAndTitle(const std::string& initiator_url, | 48 void SetInitiatorTabURLAndTitle(const std::string& initiator_url, |
49 const string16& initiator_tab_title); | 49 const string16& initiator_tab_title); |
50 | 50 |
51 string16 initiator_tab_title() { return initiator_tab_title_; } | 51 string16 initiator_tab_title() { return initiator_tab_title_; } |
52 | 52 |
| 53 bool source_is_modifiable() { return source_is_modifiable_; } |
| 54 |
| 55 void SetSourceIsModifiable(bool source_is_modifiable); |
| 56 |
53 // Determines whether to cancel a print preview request based on | 57 // Determines whether to cancel a print preview request based on |
54 // |preview_ui_addr| and |request_id|. | 58 // |preview_ui_addr| and |request_id|. |
55 // Can be called from any thread. | 59 // Can be called from any thread. |
56 static void GetCurrentPrintPreviewStatus(const std::string& preview_ui_addr, | 60 static void GetCurrentPrintPreviewStatus(const std::string& preview_ui_addr, |
57 int request_id, | 61 int request_id, |
58 bool* cancel); | 62 bool* cancel); |
59 | 63 |
60 // Returns a string to uniquely identify this PrintPreviewUI. | 64 // Returns a string to uniquely identify this PrintPreviewUI. |
61 std::string GetPrintPreviewUIAddress() const; | 65 std::string GetPrintPreviewUIAddress() const; |
62 | 66 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void OnFileSelectionCancelled(); | 111 void OnFileSelectionCancelled(); |
108 | 112 |
109 // Notifies the Web UI that the printer is unavailable or its settings are | 113 // Notifies the Web UI that the printer is unavailable or its settings are |
110 // invalid. | 114 // invalid. |
111 void OnInvalidPrinterSettings(); | 115 void OnInvalidPrinterSettings(); |
112 | 116 |
113 // Notifies the Web UI to cancel the pending preview request. | 117 // Notifies the Web UI to cancel the pending preview request. |
114 void OnCancelPendingPreviewRequest(); | 118 void OnCancelPendingPreviewRequest(); |
115 | 119 |
116 private: | 120 private: |
| 121 friend class PrintPreviewHandlerTest; |
| 122 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); |
| 123 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); |
| 124 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 125 StickyMarginsCustomThenDefault); |
| 126 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 127 GetLastUsedMarginSettingsCustom); |
| 128 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 129 GetLastUsedMarginSettingsDefault); |
117 FRIEND_TEST_ALL_PREFIXES(PrintPreviewTabControllerUnitTest, | 130 FRIEND_TEST_ALL_PREFIXES(PrintPreviewTabControllerUnitTest, |
118 TitleAfterReload); | 131 TitleAfterReload); |
119 | 132 |
120 // Returns the Singleton instance of the PrintPreviewDataService. | 133 // Returns the Singleton instance of the PrintPreviewDataService. |
121 PrintPreviewDataService* print_preview_data_service(); | 134 PrintPreviewDataService* print_preview_data_service(); |
122 | 135 |
123 base::TimeTicks initial_preview_start_time_; | 136 base::TimeTicks initial_preview_start_time_; |
124 | 137 |
125 // Store the PrintPreviewUI address string. | 138 // Store the PrintPreviewUI address string. |
126 std::string preview_ui_addr_str_; | 139 std::string preview_ui_addr_str_; |
127 | 140 |
128 // Weak pointer to the WebUI handler. | 141 // Weak pointer to the WebUI handler. |
129 PrintPreviewHandler* handler_; | 142 PrintPreviewHandler* handler_; |
130 | 143 |
131 // Store the |initiator_url| in order to display an accurate error message | 144 // Store the |initiator_url| in order to display an accurate error message |
132 // when the initiator tab is closed/crashed. | 145 // when the initiator tab is closed/crashed. |
133 std::string initiator_url_; | 146 std::string initiator_url_; |
134 | 147 |
| 148 // Indicates whether the source document can be modified. |
| 149 bool source_is_modifiable_; |
| 150 |
135 // Store the initiator tab title, used for populating the print preview tab | 151 // Store the initiator tab title, used for populating the print preview tab |
136 // title. | 152 // title. |
137 string16 initiator_tab_title_; | 153 string16 initiator_tab_title_; |
138 | 154 |
139 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 155 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
140 }; | 156 }; |
141 | 157 |
142 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 158 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
OLD | NEW |