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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Store the PrintPreviewUI address string. | 129 // Store the PrintPreviewUI address string. |
126 std::string preview_ui_addr_str_; | 130 std::string preview_ui_addr_str_; |
127 | 131 |
128 // Weak pointer to the WebUI handler. | 132 // Weak pointer to the WebUI handler. |
129 PrintPreviewHandler* handler_; | 133 PrintPreviewHandler* handler_; |
130 | 134 |
131 // Store the |initiator_url| in order to display an accurate error message | 135 // Store the |initiator_url| in order to display an accurate error message |
132 // when the initiator tab is closed/crashed. | 136 // when the initiator tab is closed/crashed. |
133 std::string initiator_url_; | 137 std::string initiator_url_; |
134 | 138 |
| 139 // Indicates whether the source document can be modified. |
| 140 bool source_is_modifiable_; |
| 141 |
135 // Store the initiator tab title, used for populating the print preview tab | 142 // Store the initiator tab title, used for populating the print preview tab |
136 // title. | 143 // title. |
137 string16 initiator_tab_title_; | 144 string16 initiator_tab_title_; |
138 | 145 |
| 146 friend class PrintPreviewHandlerTest; |
| 147 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); |
| 148 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); |
| 149 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 150 StickyMarginsCustomThenDefault); |
| 151 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 152 TestGetLastUsedMarginSettingsCustom); |
| 153 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 154 TestGetLastUsedMarginSettingsDefault); |
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 |