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 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "chrome/browser/printing/print_preview_data_service.h" | 14 #include "chrome/browser/printing/print_preview_data_service.h" |
15 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 15 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
16 | 16 |
17 class PrintPreviewDataService; | 17 class PrintPreviewDataService; |
18 class PrintPreviewHandler; | 18 class PrintPreviewHandler; |
| 19 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
19 | 20 |
20 class PrintPreviewUI : public ChromeWebUI { | 21 class PrintPreviewUI : public ChromeWebUI { |
21 public: | 22 public: |
22 explicit PrintPreviewUI(TabContents* contents); | 23 explicit PrintPreviewUI(TabContents* contents); |
23 virtual ~PrintPreviewUI(); | 24 virtual ~PrintPreviewUI(); |
24 | 25 |
25 // Gets the print preview |data|. |index| is zero-based, and can be | 26 // Gets the print preview |data|. |index| is zero-based, and can be |
26 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to get the entire preview | 27 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to get the entire preview |
27 // document. | 28 // document. |
28 void GetPrintPreviewDataForIndex(int index, | 29 void GetPrintPreviewDataForIndex(int index, |
29 scoped_refptr<RefCountedBytes>* data); | 30 scoped_refptr<RefCountedBytes>* data); |
30 | 31 |
31 // 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 |
32 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview | 33 // |printing::COMPLETE_PREVIEW_DOCUMENT_INDEX| to set the entire preview |
33 // document. | 34 // document. |
34 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data); | 35 void SetPrintPreviewDataForIndex(int index, const RefCountedBytes* data); |
35 | 36 |
36 // Clear the existing print preview data. | 37 // Clear the existing print preview data. |
37 void ClearAllPreviewData(); | 38 void ClearAllPreviewData(); |
38 | 39 |
39 // Notify the Web UI that there is a print preview request. | 40 // Notify the Web UI that there is a print preview request. |
40 // There should be a matching call to OnPreviewDataIsAvailable() or | 41 // There should be a matching call to OnPreviewDataIsAvailable() or |
41 // OnPrintPreviewFailed(). | 42 // OnPrintPreviewFailed(). |
42 void OnPrintPreviewRequest(); | 43 void OnPrintPreviewRequest(); |
43 | 44 |
44 // Notify the Web UI that the print preview will have |page_count| pages. | 45 // Notify the Web UI about the page count of the request preview. |
45 // |is_modifiable| indicates if the preview can be rerendered with different | 46 void OnDidGetPreviewPageCount( |
46 // print settings. | 47 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
47 void OnDidGetPreviewPageCount(int document_cookie_, | |
48 int page_count, | |
49 bool is_modifiable); | |
50 | 48 |
51 // Notify the Web UI that the 0-based page |page_number| has been rendered. | 49 // Notify the Web UI that the 0-based page |page_number| has been rendered. |
52 void OnDidPreviewPage(int page_number); | 50 // |preview_request_id| indicates wich request resulted in this response. |
| 51 void OnDidPreviewPage(int page_number, int preview_request_id); |
53 | 52 |
54 // Notify the Web UI renderer that preview data is available. | 53 // Notify the Web UI renderer that preview data is available. |
55 // |expected_pages_count| specifies the total number of pages. | 54 // |expected_pages_count| specifies the total number of pages. |
56 // |job_title| is the title of the page being previewed. | 55 // |job_title| is the title of the page being previewed. |
57 // |preview_request_id| indicates wich request resulted in this response. | 56 // |preview_request_id| indicates wich request resulted in this response. |
58 void OnPreviewDataIsAvailable(int expected_pages_count, | 57 void OnPreviewDataIsAvailable(int expected_pages_count, |
59 const string16& job_title, | 58 const string16& job_title, |
60 int preview_request_id); | 59 int preview_request_id); |
61 | 60 |
62 void OnReusePreviewData(int preview_request_id); | 61 void OnReusePreviewData(int preview_request_id); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // The number of print preview requests in flight. | 102 // The number of print preview requests in flight. |
104 uint32 request_count_; | 103 uint32 request_count_; |
105 | 104 |
106 // Document cookie from the initiator renderer. | 105 // Document cookie from the initiator renderer. |
107 int document_cookie_; | 106 int document_cookie_; |
108 | 107 |
109 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 108 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
110 }; | 109 }; |
111 | 110 |
112 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 111 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
OLD | NEW |