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

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

Issue 7747033: Merge 97702, 97820, 97976 (Closed) Base URL: svn://chrome-svn/chrome/branches/835/src/
Patch Set: Created 9 years, 3 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 19 matching lines...) Expand all
30 scoped_refptr<RefCountedBytes>* data); 30 scoped_refptr<RefCountedBytes>* data);
31 31
32 // Sets the print preview |data|. |index| is zero-based, and can be 32 // Sets the print preview |data|. |index| is zero-based, and can be
33 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview 33 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview
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 // Notify the Web UI that there is a print preview request. 40 // Determines whether to cancel a print preview request based on
41 // There should be a matching call to OnPreviewDataIsAvailable() or 41 // |preview_ui_addr| and |request_id|.
42 // OnPrintPreviewFailed(). 42 // Can be called from any thread.
43 void OnPrintPreviewRequest(); 43 static void GetCurrentPrintPreviewStatus(const std::string& preview_ui_addr,
44 int request_id,
45 bool* cancel);
46
47 // Returns a string to uniquely identify this PrintPreviewUI.
48 std::string GetPrintPreviewUIAddress() const;
49
50 // Notifies the Web UI of a print preview request with |request_id|.
51 void OnPrintPreviewRequest(int request_id);
44 52
45 // Notifies the Web UI about the page count of the request preview. 53 // Notifies the Web UI about the page count of the request preview.
46 void OnDidGetPreviewPageCount( 54 void OnDidGetPreviewPageCount(
47 const PrintHostMsg_DidGetPreviewPageCount_Params& params); 55 const PrintHostMsg_DidGetPreviewPageCount_Params& params);
48 56
49 // Notify the Web UI that the 0-based page |page_number| has been rendered. 57 // Notify the Web UI that the 0-based page |page_number| has been rendered.
50 // |preview_request_id| indicates wich request resulted in this response. 58 // |preview_request_id| indicates wich request resulted in this response.
51 void OnDidPreviewPage(int page_number, int preview_request_id); 59 void OnDidPreviewPage(int page_number, int preview_request_id);
52 60
53 // Notify the Web UI renderer that preview data is available. 61 // Notify the Web UI renderer that preview data is available.
54 // |expected_pages_count| specifies the total number of pages. 62 // |expected_pages_count| specifies the total number of pages.
55 // |job_title| is the title of the page being previewed. 63 // |job_title| is the title of the page being previewed.
56 // |preview_request_id| indicates wich request resulted in this response. 64 // |preview_request_id| indicates wich request resulted in this response.
57 void OnPreviewDataIsAvailable(int expected_pages_count, 65 void OnPreviewDataIsAvailable(int expected_pages_count,
58 const string16& job_title, 66 const string16& job_title,
59 int preview_request_id); 67 int preview_request_id);
60 68
61 void OnReusePreviewData(int preview_request_id); 69 void OnReusePreviewData(int preview_request_id);
62 70
63 // Notify the Web UI that a navigation has occurred in this tab. This is the 71 // Notify the Web UI that a navigation has occurred in this tab. This is the
64 // last chance to communicate with the source tab before the assocation is 72 // last chance to communicate with the source tab before the assocation is
65 // erased. 73 // erased.
66 void OnNavigation(); 74 void OnNavigation();
67 75
68 // Notify the Web UI that the print preview failed to render. 76 // Notify the Web UI that the print preview failed to render.
69 void OnPrintPreviewFailed(); 77 void OnPrintPreviewFailed();
70 78
71 // Notify the Web UI that the print preview request has been cancelled.
72 void OnPrintPreviewCancelled();
73
74 // Notify the Web UI that initiator tab is closed, so we can disable all 79 // Notify the Web UI that initiator tab is closed, so we can disable all
75 // the controls that need the initiator tab for generating the preview data. 80 // the controls that need the initiator tab for generating the preview data.
76 // |initiator_tab_url| is passed in order to display a more accurate error 81 // |initiator_tab_url| is passed in order to display a more accurate error
77 // message. 82 // message.
78 void OnInitiatorTabClosed(const std::string& initiator_tab_url); 83 void OnInitiatorTabClosed(const std::string& initiator_tab_url);
79 84
80 // Notify the Web UI renderer that file selection has been cancelled. 85 // Notify the Web UI renderer that file selection has been cancelled.
81 void OnFileSelectionCancelled(); 86 void OnFileSelectionCancelled();
82 87
83 // Return true if there are pending requests.
84 bool HasPendingRequests();
85
86 int document_cookie();
87
88 private: 88 private:
89 // Helper function 89 // Helper function
90 PrintPreviewDataService* print_preview_data_service(); 90 PrintPreviewDataService* print_preview_data_service();
91 91
92 void DecrementRequestCount();
93
94 base::TimeTicks initial_preview_start_time_; 92 base::TimeTicks initial_preview_start_time_;
95 93
96 // Store the PrintPreviewUI address string. 94 // Store the PrintPreviewUI address string.
97 std::string preview_ui_addr_str_; 95 std::string preview_ui_addr_str_;
98 96
99 // Weak pointer to the WebUI handler. 97 // Weak pointer to the WebUI handler.
100 PrintPreviewHandler* handler_; 98 PrintPreviewHandler* handler_;
101 99
102 // The number of print preview requests in flight.
103 uint32 request_count_;
104
105 // Document cookie from the initiator renderer.
106 int document_cookie_;
107
108 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 100 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
109 }; 101 };
110 102
111 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 103 #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