Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1382)

Side by Side Diff: chrome/browser/ui/webui/print_preview_ui.h

Issue 8136027: Print Preview: Make print preview tab modal. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address preview tab navigation, cancelling print to pdf issues Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/printing/print_preview_data_service.h" 14 #include "chrome/browser/printing/print_preview_data_service.h"
15 #include "chrome/browser/ui/webui/chrome_web_ui.h" 15 #include "chrome/browser/ui/webui/constrained_html_ui.h"
16 16
17 class PrintPreviewDataService; 17 class PrintPreviewDataService;
18 class PrintPreviewHandler; 18 class PrintPreviewHandler;
19 struct PrintHostMsg_DidGetPreviewPageCount_Params; 19 struct PrintHostMsg_DidGetPreviewPageCount_Params;
20 20
21 namespace printing { 21 namespace printing {
22 struct PageSizeMargins; 22 struct PageSizeMargins;
23 } 23 }
24 24
25 class PrintPreviewUI : public ChromeWebUI { 25 class PrintPreviewUI : public ConstrainedHtmlUI {
26 public: 26 public:
27 explicit PrintPreviewUI(TabContents* contents); 27 explicit PrintPreviewUI(TabContents* contents);
28 virtual ~PrintPreviewUI(); 28 virtual ~PrintPreviewUI();
29 29
30 // Gets the print preview |data|. |index| is zero-based, and can be 30 // Gets the print preview |data|. |index| is zero-based, and can be
31 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to get the entire preview 31 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to get the entire preview
32 // document. 32 // document.
33 void GetPrintPreviewDataForIndex(int index, 33 void GetPrintPreviewDataForIndex(int index,
34 scoped_refptr<RefCountedBytes>* data); 34 scoped_refptr<RefCountedBytes>* data);
35 35
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // |preview_request_id| indicates which request resulted in this response. 89 // |preview_request_id| indicates which request resulted in this response.
90 void OnReusePreviewData(int preview_request_id); 90 void OnReusePreviewData(int preview_request_id);
91 91
92 // Notifies the Web UI that preview tab is destroyed. This is the last chance 92 // Notifies the Web UI that preview tab is destroyed. This is the last chance
93 // to communicate with the source tab before the association is erased. 93 // to communicate with the source tab before the association is erased.
94 void OnTabDestroyed(); 94 void OnTabDestroyed();
95 95
96 // Notifies the Web UI that the print preview failed to render. 96 // Notifies the Web UI that the print preview failed to render.
97 void OnPrintPreviewFailed(); 97 void OnPrintPreviewFailed();
98 98
99 // Notified the Web UI that this print preview tab has crashed.
100 void OnPrintPreviewTabCrashed();
101
99 // Notifies the Web UI that initiator tab is closed, so we can disable all the 102 // Notifies the Web UI that initiator tab is closed, so we can disable all the
100 // controls that need the initiator tab for generating the preview data. 103 // controls that need the initiator tab for generating the preview data.
101 void OnInitiatorTabClosed(); 104 void OnInitiatorTabClosed();
102 105
103 // Notifies the Web UI that the initiator tab has crashed.
104 void OnInitiatorTabCrashed();
105
106 // Notifies the Web UI renderer that file selection has been cancelled. 106 // Notifies the Web UI renderer that file selection has been cancelled.
107 void OnFileSelectionCancelled(); 107 void OnFileSelectionCancelled();
108 108
109 // 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
110 // invalid. 110 // invalid.
111 void OnInvalidPrinterSettings(); 111 void OnInvalidPrinterSettings();
112 112
113 // Notifies the Web UI to cancel the pending preview request. 113 // Notifies the Web UI to cancel the pending preview request.
114 void OnCancelPendingPreviewRequest(); 114 void OnCancelPendingPreviewRequest();
115 115
116 // Hide the print preview tab.
117 void HidePreviewTab();
kmadhusu 2011/10/14 00:21:09 nit: OnHidePreviewTab() and OnClosePrintPreviewTab
Lei Zhang 2011/10/14 20:31:27 Done.
118
119 // Close the print preview tab.
120 void ClosePrintPreviewTab();
121
116 private: 122 private:
117 FRIEND_TEST_ALL_PREFIXES(PrintPreviewTabControllerUnitTest, 123 FRIEND_TEST_ALL_PREFIXES(PrintPreviewTabControllerUnitTest,
118 TitleAfterReload); 124 TitleAfterReload);
119 125
120 // Returns the Singleton instance of the PrintPreviewDataService. 126 // Returns the Singleton instance of the PrintPreviewDataService.
121 PrintPreviewDataService* print_preview_data_service(); 127 PrintPreviewDataService* print_preview_data_service();
122 128
123 base::TimeTicks initial_preview_start_time_; 129 base::TimeTicks initial_preview_start_time_;
124 130
125 // Store the PrintPreviewUI address string. 131 // Store the PrintPreviewUI address string.
126 std::string preview_ui_addr_str_; 132 std::string preview_ui_addr_str_;
127 133
128 // Weak pointer to the WebUI handler. 134 // Weak pointer to the WebUI handler.
129 PrintPreviewHandler* handler_; 135 PrintPreviewHandler* handler_;
130 136
131 // Store the |initiator_url| in order to display an accurate error message 137 // Store the |initiator_url| in order to display an accurate error message
132 // when the initiator tab is closed/crashed. 138 // when the initiator tab is closed/crashed.
133 std::string initiator_url_; 139 std::string initiator_url_;
134 140
135 // Store the initiator tab title, used for populating the print preview tab 141 // Store the initiator tab title, used for populating the print preview tab
136 // title. 142 // title.
137 string16 initiator_tab_title_; 143 string16 initiator_tab_title_;
138 144
139 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 145 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
140 }; 146 };
141 147
142 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 148 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698