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