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 23 matching lines...) Expand all Loading... |
34 scoped_refptr<RefCountedBytes>* data); | 34 scoped_refptr<RefCountedBytes>* data); |
35 | 35 |
36 // Sets the print preview |data|. |index| is zero-based, and can be | 36 // Sets the print preview |data|. |index| is zero-based, and can be |
37 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview | 37 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview |
38 // document. | 38 // document. |
39 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data); | 39 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data); |
40 | 40 |
41 // Clear the existing print preview data. | 41 // Clear the existing print preview data. |
42 void ClearAllPreviewData(); | 42 void ClearAllPreviewData(); |
43 | 43 |
| 44 // Returns true if all the draft pages are available. |draft_page_count| |
| 45 // specifies the total number of draft pages. |
| 46 bool IsDraftPagesAvailable(int draft_page_count); |
| 47 |
44 // Setters | 48 // Setters |
45 void SetInitiatorTabURLAndTitle(const std::string& initiator_url, | 49 void SetInitiatorTabURLAndTitle(const std::string& initiator_url, |
46 const string16& initiator_tab_title); | 50 const string16& initiator_tab_title); |
47 | 51 |
48 // Determines whether to cancel a print preview request based on | 52 // Determines whether to cancel a print preview request based on |
49 // |preview_ui_addr| and |request_id|. | 53 // |preview_ui_addr| and |request_id|. |
50 // Can be called from any thread. | 54 // Can be called from any thread. |
51 static void GetCurrentPrintPreviewStatus(const std::string& preview_ui_addr, | 55 static void GetCurrentPrintPreviewStatus(const std::string& preview_ui_addr, |
52 int request_id, | 56 int request_id, |
53 bool* cancel); | 57 bool* cancel); |
(...skipping 19 matching lines...) Expand all Loading... |
73 // Notifies the Web UI that the 0-based page |page_number| has been rendered. | 77 // Notifies the Web UI that the 0-based page |page_number| has been rendered. |
74 // |preview_request_id| indicates wich request resulted in this response. | 78 // |preview_request_id| indicates wich request resulted in this response. |
75 void OnDidPreviewPage(int page_number, int preview_request_id); | 79 void OnDidPreviewPage(int page_number, int preview_request_id); |
76 | 80 |
77 // Notifies the Web UI renderer that preview data is available. | 81 // Notifies the Web UI renderer that preview data is available. |
78 // |expected_pages_count| specifies the total number of pages. | 82 // |expected_pages_count| specifies the total number of pages. |
79 // |preview_request_id| indicates which request resulted in this response. | 83 // |preview_request_id| indicates which request resulted in this response. |
80 void OnPreviewDataIsAvailable(int expected_pages_count, | 84 void OnPreviewDataIsAvailable(int expected_pages_count, |
81 int preview_request_id); | 85 int preview_request_id); |
82 | 86 |
| 87 // Notifies the Web UI renderer to reuse the preview data. |
| 88 // |preview_request_id| indicates which request resulted in this response. |
83 void OnReusePreviewData(int preview_request_id); | 89 void OnReusePreviewData(int preview_request_id); |
84 | 90 |
85 // Notifies the Web UI that preview tab is destroyed. This is the last chance | 91 // Notifies the Web UI that preview tab is destroyed. This is the last chance |
86 // to communicate with the source tab before the association is erased. | 92 // to communicate with the source tab before the association is erased. |
87 void OnTabDestroyed(); | 93 void OnTabDestroyed(); |
88 | 94 |
89 // Notifies the Web UI that the print preview failed to render. | 95 // Notifies the Web UI that the print preview failed to render. |
90 void OnPrintPreviewFailed(); | 96 void OnPrintPreviewFailed(); |
91 | 97 |
92 // Notifies the Web UI that initiator tab is closed, so we can disable all the | 98 // Notifies the Web UI that initiator tab is closed, so we can disable all the |
(...skipping 29 matching lines...) Expand all Loading... |
122 std::string initiator_url_; | 128 std::string initiator_url_; |
123 | 129 |
124 // Store the initiator tab title, used for populating the print preview tab | 130 // Store the initiator tab title, used for populating the print preview tab |
125 // title. | 131 // title. |
126 string16 initiator_tab_title_; | 132 string16 initiator_tab_title_; |
127 | 133 |
128 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 134 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
129 }; | 135 }; |
130 | 136 |
131 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 137 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
OLD | NEW |