Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 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 // Setters | |
| 41 void SetInitiatorTabURL(const std::string& initiator_url); | |
| 42 | |
| 40 // Notifies the Web UI that there is a print preview request. There should be | 43 // Notifies the Web UI that there is a print preview request. There should be |
| 41 // a matching call to OnPreviewDataIsAvailable() or OnPrintPreviewFailed(). | 44 // a matching call to OnPreviewDataIsAvailable() or OnPrintPreviewFailed(). |
| 42 void OnPrintPreviewRequest(); | 45 void OnPrintPreviewRequest(); |
| 43 | 46 |
| 44 // Notifies the Web UI about the page count of the request preview. | 47 // Notifies the Web UI about the page count of the request preview. |
| 45 void OnDidGetPreviewPageCount( | 48 void OnDidGetPreviewPageCount( |
| 46 const PrintHostMsg_DidGetPreviewPageCount_Params& params); | 49 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
| 47 | 50 |
| 48 // Notifies the Web UI that the 0-based page |page_number| has been rendered. | 51 // Notifies the Web UI that the 0-based page |page_number| has been rendered. |
| 49 // |preview_request_id| indicates wich request resulted in this response. | 52 // |preview_request_id| indicates wich request resulted in this response. |
| 50 void OnDidPreviewPage(int page_number, int preview_request_id); | 53 void OnDidPreviewPage(int page_number, int preview_request_id); |
| 51 | 54 |
| 52 // Notifies the Web UI renderer that preview data is available. | 55 // Notifies the Web UI renderer that preview data is available. |
| 53 // |expected_pages_count| specifies the total number of pages. |job_title| is | 56 // |expected_pages_count| specifies the total number of pages. |job_title| is |
| 54 // the title of the page being previewed. |preview_request_id| indicates which | 57 // the title of the page being previewed. |preview_request_id| indicates which |
| 55 // request resulted in this response. | 58 // request resulted in this response. |
| 56 void OnPreviewDataIsAvailable(int expected_pages_count, | 59 void OnPreviewDataIsAvailable(int expected_pages_count, |
| 57 const string16& job_title, | 60 const string16& job_title, |
| 58 int preview_request_id); | 61 int preview_request_id); |
| 59 | 62 |
| 60 void OnReusePreviewData(int preview_request_id); | 63 void OnReusePreviewData(int preview_request_id); |
| 61 | 64 |
| 62 // Notifies the Web UI that a navigation has occurred in this tab. This is the | 65 // Notifies the Web UI that a navigation has occurred in this tab. This is the |
|
Lei Zhang
2011/08/16 00:59:23
This comment is out of date.
kmadhusu
2011/08/16 01:31:37
Fixed.
| |
| 63 // last chance to communicate with the source tab before the association is | 66 // last chance to communicate with the source tab before the association is |
| 64 // erased. | 67 // erased. |
| 65 void OnNavigation(); | 68 void OnTabDestroyed(); |
| 66 | 69 |
| 67 // Notifies the Web UI that the print preview failed to render. | 70 // Notifies the Web UI that the print preview failed to render. |
| 68 void OnPrintPreviewFailed(); | 71 void OnPrintPreviewFailed(); |
| 69 | 72 |
| 70 // Notifies the Web UI that the print preview request has been cancelled. | 73 // Notifies the Web UI that the print preview request has been cancelled. |
| 71 void OnPrintPreviewCancelled(); | 74 void OnPrintPreviewCancelled(); |
| 72 | 75 |
| 73 // Notifies the Web UI that initiator tab is closed, so we can disable all the | 76 // Notifies the Web UI that initiator tab is closed, so we can disable all the |
| 74 // controls that need the initiator tab for generating the preview data. | 77 // controls that need the initiator tab for generating the preview data. |
| 75 void OnInitiatorTabClosed(const std::string& initiator_url); | 78 void OnInitiatorTabClosed(); |
| 79 | |
| 80 // Notifies the Web UI that the initiator tab has crashed. | |
| 81 void OnInitiatorTabCrashed(); | |
| 76 | 82 |
| 77 // Notifies the Web UI renderer that file selection has been cancelled. | 83 // Notifies the Web UI renderer that file selection has been cancelled. |
| 78 void OnFileSelectionCancelled(); | 84 void OnFileSelectionCancelled(); |
| 79 | 85 |
| 80 // Returns true if there are pending requests. | 86 // Returns true if there are pending requests. |
| 81 bool HasPendingRequests(); | 87 bool HasPendingRequests(); |
| 82 | 88 |
| 83 int document_cookie(); | 89 int document_cookie(); |
| 84 | 90 |
| 85 private: | 91 private: |
| 86 // Returns the Singleton instance of the PrintPreviewDataService. | 92 // Returns the Singleton instance of the PrintPreviewDataService. |
| 87 PrintPreviewDataService* print_preview_data_service(); | 93 PrintPreviewDataService* print_preview_data_service(); |
| 88 | 94 |
| 89 void DecrementRequestCount(); | 95 void DecrementRequestCount(); |
| 90 | 96 |
| 91 base::TimeTicks initial_preview_start_time_; | 97 base::TimeTicks initial_preview_start_time_; |
| 92 | 98 |
| 93 // Store the PrintPreviewUI address string. | 99 // Store the PrintPreviewUI address string. |
| 94 std::string preview_ui_addr_str_; | 100 std::string preview_ui_addr_str_; |
| 95 | 101 |
| 96 // Weak pointer to the WebUI handler. | 102 // Weak pointer to the WebUI handler. |
| 97 PrintPreviewHandler* handler_; | 103 PrintPreviewHandler* handler_; |
| 98 | 104 |
| 99 // The number of print preview requests in flight. | 105 // The number of print preview requests in flight. |
| 100 uint32 request_count_; | 106 uint32 request_count_; |
| 101 | 107 |
| 102 // Document cookie from the initiator renderer. | 108 // Document cookie from the initiator renderer. |
| 103 int document_cookie_; | 109 int document_cookie_; |
| 104 | 110 |
| 111 // Store the |initiator_url| in order to display an accurate error message | |
| 112 // when the initiator tab is closed/crashed. | |
| 113 std::string initiator_url_; | |
| 114 | |
| 105 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 115 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 106 }; | 116 }; |
| 107 | 117 |
| 108 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 118 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |