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