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

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

Issue 7550063: Print Preview: Handle a crashed initiator tab by showing a message in PP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 4 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
(...skipping 18 matching lines...) Expand all
29 scoped_refptr<RefCountedBytes>* data); 29 scoped_refptr<RefCountedBytes>* data);
30 30
31 // Sets the print preview |data|. |index| is zero-based, and can be 31 // Sets the print preview |data|. |index| is zero-based, and can be
32 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview 32 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview
33 // document. 33 // document.
34 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data); 34 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data);
35 35
36 // Clear the existing print preview data. 36 // Clear the existing print preview data.
37 void ClearAllPreviewData(); 37 void ClearAllPreviewData();
38 38
39 // Setters
40 void SetInitiatorTabURL(const std::string& initiator_url);
41
39 // Notify the Web UI that there is a print preview request. 42 // Notify the Web UI that there is a print preview request.
40 // There should be a matching call to OnPreviewDataIsAvailable() or 43 // There should be a matching call to OnPreviewDataIsAvailable() or
41 // OnPrintPreviewFailed(). 44 // OnPrintPreviewFailed().
42 void OnPrintPreviewRequest(); 45 void OnPrintPreviewRequest();
43 46
44 // Notify the Web UI that the print preview will have |page_count| pages. 47 // Notify the Web UI that the print preview will have |page_count| pages.
45 // |is_modifiable| indicates if the preview can be rerendered with different 48 // |is_modifiable| indicates if the preview can be rerendered with different
46 // print settings. 49 // print settings.
47 void OnDidGetPreviewPageCount(int document_cookie_, 50 void OnDidGetPreviewPageCount(int document_cookie_,
48 int page_count, 51 int page_count,
(...skipping 20 matching lines...) Expand all
69 // Notify the Web UI that the print preview failed to render. 72 // Notify the Web UI that the print preview failed to render.
70 void OnPrintPreviewFailed(); 73 void OnPrintPreviewFailed();
71 74
72 // Notify the Web UI that the print preview request has been cancelled. 75 // Notify the Web UI that the print preview request has been cancelled.
73 void OnPrintPreviewCancelled(); 76 void OnPrintPreviewCancelled();
74 77
75 // Notify the Web UI that initiator tab is closed, so we can disable all 78 // Notify the Web UI that initiator tab is closed, so we can disable all
76 // the controls that need the initiator tab for generating the preview data. 79 // the controls that need the initiator tab for generating the preview data.
77 // |initiator_tab_url| is passed in order to display a more accurate error 80 // |initiator_tab_url| is passed in order to display a more accurate error
78 // message. 81 // message.
79 void OnInitiatorTabClosed(const std::string& initiator_tab_url); 82 void OnInitiatorTabClosed();
83
84 // Notifies the Web UI that the initiator tab has crashed.
85 void OnInitiatorTabCrashed();
80 86
81 // Notify the Web UI renderer that file selection has been cancelled. 87 // Notify the Web UI renderer that file selection has been cancelled.
82 void OnFileSelectionCancelled(); 88 void OnFileSelectionCancelled();
83 89
84 // Return true if there are pending requests. 90 // Return true if there are pending requests.
85 bool HasPendingRequests(); 91 bool HasPendingRequests();
86 92
87 int document_cookie(); 93 int document_cookie();
88 94
89 private: 95 private:
90 // Helper function 96 // Helper function
91 PrintPreviewDataService* print_preview_data_service(); 97 PrintPreviewDataService* print_preview_data_service();
92 98
93 void DecrementRequestCount(); 99 void DecrementRequestCount();
94 100
95 base::TimeTicks initial_preview_start_time_; 101 base::TimeTicks initial_preview_start_time_;
96 102
97 // Store the PrintPreviewUI address string. 103 // Store the PrintPreviewUI address string.
98 std::string preview_ui_addr_str_; 104 std::string preview_ui_addr_str_;
99 105
100 // Weak pointer to the WebUI handler. 106 // Weak pointer to the WebUI handler.
101 PrintPreviewHandler* handler_; 107 PrintPreviewHandler* handler_;
102 108
103 // The number of print preview requests in flight. 109 // The number of print preview requests in flight.
104 uint32 request_count_; 110 uint32 request_count_;
105 111
106 // Document cookie from the initiator renderer. 112 // Document cookie from the initiator renderer.
107 int document_cookie_; 113 int document_cookie_;
108 114
115 // Store the |initiator_url| in order to display an accurate error message
116 // when the initiator tab is closed/crashed.
117 std::string initiator_url_;
118
109 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 119 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
110 }; 120 };
111 121
112 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 122 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698