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

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

Issue 7621087: Print Preview: Go from event driven print preview back to print preview with sync messages. The s... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix missing lock 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 23 matching lines...) Expand all
34 // document. 34 // document.
35 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data); 35 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data);
36 36
37 // Clear the existing print preview data. 37 // Clear the existing print preview data.
38 void ClearAllPreviewData(); 38 void ClearAllPreviewData();
39 39
40 // Setters 40 // Setters
41 void SetInitiatorTabURLAndTitle(const std::string& initiator_url, 41 void SetInitiatorTabURLAndTitle(const std::string& initiator_url,
42 const string16& initiator_tab_title); 42 const string16& initiator_tab_title);
43 43
44 // Notifies the Web UI that there is a print preview request. There should be 44 // Determines whether to cancel a print preview request based on
45 // a matching call to OnPreviewDataIsAvailable() or OnPrintPreviewFailed(). 45 // |preview_ui_addr| and |request_id|.
46 void OnPrintPreviewRequest(); 46 // Can be called from any thread.
47 static void GetCurrentPrintPreviewStatus(const std::string& preview_ui_addr,
48 int request_id,
49 bool* cancel);
50
51 // Returns a string to uniquely identify this PrintPreviewUI.
52 std::string GetPrintPreviewUIAddress() const;
53
54 // Notifies the Web UI of a print preview request with |request_id|.
55 void OnPrintPreviewRequest(int request_id);
47 56
48 // Notifies the Web UI about the page count of the request preview. 57 // Notifies the Web UI about the page count of the request preview.
49 void OnDidGetPreviewPageCount( 58 void OnDidGetPreviewPageCount(
50 const PrintHostMsg_DidGetPreviewPageCount_Params& params); 59 const PrintHostMsg_DidGetPreviewPageCount_Params& params);
51 60
52 // Notifies the Web UI that the 0-based page |page_number| has been rendered. 61 // Notifies the Web UI that the 0-based page |page_number| has been rendered.
53 // |preview_request_id| indicates wich request resulted in this response. 62 // |preview_request_id| indicates wich request resulted in this response.
54 void OnDidPreviewPage(int page_number, int preview_request_id); 63 void OnDidPreviewPage(int page_number, int preview_request_id);
55 64
56 // Notifies the Web UI renderer that preview data is available. 65 // Notifies the Web UI renderer that preview data is available.
57 // |expected_pages_count| specifies the total number of pages. 66 // |expected_pages_count| specifies the total number of pages.
58 // |preview_request_id| indicates which request resulted in this response. 67 // |preview_request_id| indicates which request resulted in this response.
59 void OnPreviewDataIsAvailable(int expected_pages_count, 68 void OnPreviewDataIsAvailable(int expected_pages_count,
60 int preview_request_id); 69 int preview_request_id);
61 70
62 void OnReusePreviewData(int preview_request_id); 71 void OnReusePreviewData(int preview_request_id);
63 72
64 // Notifies the Web UI that preview tab is destroyed. This is the last chance 73 // Notifies the Web UI that preview tab is destroyed. This is the last chance
65 // to communicate with the source tab before the association is erased. 74 // to communicate with the source tab before the association is erased.
66 void OnTabDestroyed(); 75 void OnTabDestroyed();
67 76
68 // Notifies the Web UI that the print preview failed to render. 77 // Notifies the Web UI that the print preview failed to render.
69 void OnPrintPreviewFailed(); 78 void OnPrintPreviewFailed();
70 79
71 // Notifies the Web UI that the print preview request has been cancelled.
72 void OnPrintPreviewCancelled();
73
74 // Notifies the Web UI that initiator tab is closed, so we can disable all the 80 // Notifies the Web UI that initiator tab is closed, so we can disable all the
75 // controls that need the initiator tab for generating the preview data. 81 // controls that need the initiator tab for generating the preview data.
76 void OnInitiatorTabClosed(); 82 void OnInitiatorTabClosed();
77 83
78 // Notifies the Web UI that the initiator tab has crashed. 84 // Notifies the Web UI that the initiator tab has crashed.
79 void OnInitiatorTabCrashed(); 85 void OnInitiatorTabCrashed();
80 86
81 // Notifies the Web UI renderer that file selection has been cancelled. 87 // Notifies the Web UI renderer that file selection has been cancelled.
82 void OnFileSelectionCancelled(); 88 void OnFileSelectionCancelled();
83 89
84 // Returns true if there are pending requests.
85 bool HasPendingRequests();
86
87 int document_cookie();
88
89 private: 90 private:
90 // Returns the Singleton instance of the PrintPreviewDataService. 91 // Returns the Singleton instance of the PrintPreviewDataService.
91 PrintPreviewDataService* print_preview_data_service(); 92 PrintPreviewDataService* print_preview_data_service();
92 93
93 void DecrementRequestCount();
94
95 base::TimeTicks initial_preview_start_time_; 94 base::TimeTicks initial_preview_start_time_;
96 95
97 // Store the PrintPreviewUI address string. 96 // Store the PrintPreviewUI address string.
98 std::string preview_ui_addr_str_; 97 std::string preview_ui_addr_str_;
99 98
100 // Weak pointer to the WebUI handler. 99 // Weak pointer to the WebUI handler.
101 PrintPreviewHandler* handler_; 100 PrintPreviewHandler* handler_;
102 101
103 // The number of print preview requests in flight.
104 uint32 request_count_;
105
106 // Document cookie from the initiator renderer.
107 int document_cookie_;
108
109 // Store the |initiator_url| in order to display an accurate error message 102 // Store the |initiator_url| in order to display an accurate error message
110 // when the initiator tab is closed/crashed. 103 // when the initiator tab is closed/crashed.
111 std::string initiator_url_; 104 std::string initiator_url_;
112 105
113 // Store the initiator tab title, used for populating the print preview tab 106 // Store the initiator tab title, used for populating the print preview tab
114 // title. 107 // title.
115 string16 initiator_tab_title_; 108 string16 initiator_tab_title_;
116 109
117 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 110 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
118 }; 111 };
119 112
120 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 113 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | chrome/browser/ui/webui/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698