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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Sets the print preview |data|. | 30 // Sets the print preview |data|. |
31 void SetPrintPreviewData(const RefCountedBytes* data); | 31 void SetPrintPreviewData(const RefCountedBytes* data); |
32 | 32 |
33 // Notify the Web UI that there is a print preview request. | 33 // Notify the Web UI that there is a print preview request. |
34 // There should be a matching call to OnPreviewDataIsAvailable() or | 34 // There should be a matching call to OnPreviewDataIsAvailable() or |
35 // OnPrintPreviewFailed(). | 35 // OnPrintPreviewFailed(). |
36 void OnPrintPreviewRequest(); | 36 void OnPrintPreviewRequest(); |
37 | 37 |
38 // Notify the Web UI that the print preview will have |page_count| pages. | 38 // Notify the Web UI that the print preview will have |page_count| pages. |
39 void OnDidGetPreviewPageCount(int page_count); | 39 void OnDidGetPreviewPageCount(int document_cookie_, int page_count); |
40 | 40 |
41 // Notify the Web UI that the 0-based page |page_number| has been rendered. | 41 // Notify the Web UI that the 0-based page |page_number| has been rendered. |
42 void OnDidPreviewPage(int page_number); | 42 void OnDidPreviewPage(int page_number); |
43 | 43 |
44 // Notify the Web UI renderer that preview data is available. | 44 // Notify the Web UI renderer that preview data is available. |
45 // |expected_pages_count| specifies the total number of pages. | 45 // |expected_pages_count| specifies the total number of pages. |
46 // |job_title| is the title of the page being previewed. | 46 // |job_title| is the title of the page being previewed. |
47 // |modifiable| indicates if the preview can be rerendered with different | 47 // |modifiable| indicates if the preview can be rerendered with different |
48 // print settings. | 48 // print settings. |
49 // |preview_request_id| indicates wich request resulted in this response. | 49 // |preview_request_id| indicates wich request resulted in this response. |
(...skipping 18 matching lines...) Expand all Loading... |
68 // |initiator_tab_url| is passed in order to display a more accurate error | 68 // |initiator_tab_url| is passed in order to display a more accurate error |
69 // message. | 69 // message. |
70 void OnInitiatorTabClosed(const std::string& initiator_tab_url); | 70 void OnInitiatorTabClosed(const std::string& initiator_tab_url); |
71 | 71 |
72 // Notify the Web UI renderer that file selection has been cancelled. | 72 // Notify the Web UI renderer that file selection has been cancelled. |
73 void OnFileSelectionCancelled(); | 73 void OnFileSelectionCancelled(); |
74 | 74 |
75 // Return true if there are pending requests. | 75 // Return true if there are pending requests. |
76 bool HasPendingRequests(); | 76 bool HasPendingRequests(); |
77 | 77 |
| 78 int document_cookie(); |
| 79 |
78 private: | 80 private: |
79 // Helper function | 81 // Helper function |
80 PrintPreviewDataService* print_preview_data_service(); | 82 PrintPreviewDataService* print_preview_data_service(); |
81 | 83 |
82 void DecrementRequestCount(); | 84 void DecrementRequestCount(); |
83 | 85 |
84 base::TimeTicks initial_preview_start_time_; | 86 base::TimeTicks initial_preview_start_time_; |
85 | 87 |
86 // Store the PrintPreviewUI address string. | 88 // Store the PrintPreviewUI address string. |
87 std::string preview_ui_addr_str_; | 89 std::string preview_ui_addr_str_; |
88 | 90 |
89 // Weak pointer to the WebUI handler. | 91 // Weak pointer to the WebUI handler. |
90 PrintPreviewHandler* handler_; | 92 PrintPreviewHandler* handler_; |
91 | 93 |
92 // The number of print preview requests in flight. | 94 // The number of print preview requests in flight. |
93 uint32 request_count_; | 95 uint32 request_count_; |
94 | 96 |
| 97 // Document cookie from the initiator renderer. |
| 98 int document_cookie_; |
| 99 |
95 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 100 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
96 }; | 101 }; |
97 | 102 |
98 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 103 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
OLD | NEW |