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 |
| 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 that the print preview will have |params.page_count| |
| 45 // |is_modifiable| indicates if the preview can be rerendered with different | 46 // pages. |params.is_modifiable| indicates if the preview can be rerendered |
|
kmadhusu
2011/08/10 17:12:40
nit: I think the struct definition has a detailed
dpapad
2011/08/10 17:21:40
Done. Removed the details from this comment.
| |
| 46 // print settings. | 47 // with different print settings. |params.preview_request_id| indicates wich |
| 47 void OnDidGetPreviewPageCount(int document_cookie_, | 48 // request resulted in this response. |
| 48 int page_count, | 49 void OnDidGetPreviewPageCount( |
| 49 bool is_modifiable); | 50 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
| 50 | 51 |
| 51 // Notify the Web UI that the 0-based page |page_number| has been rendered. | 52 // Notify the Web UI that the 0-based page |page_number| has been rendered. |
| 52 void OnDidPreviewPage(int page_number); | 53 // |preview_request_id| indicates wich request resulted in this response. |
| 54 void OnDidPreviewPage(int page_number, int preview_request_id); | |
| 53 | 55 |
| 54 // Notify the Web UI renderer that preview data is available. | 56 // Notify the Web UI renderer that preview data is available. |
| 55 // |expected_pages_count| specifies the total number of pages. | 57 // |expected_pages_count| specifies the total number of pages. |
| 56 // |job_title| is the title of the page being previewed. | 58 // |job_title| is the title of the page being previewed. |
| 57 // |preview_request_id| indicates wich request resulted in this response. | 59 // |preview_request_id| indicates wich request resulted in this response. |
| 58 void OnPreviewDataIsAvailable(int expected_pages_count, | 60 void OnPreviewDataIsAvailable(int expected_pages_count, |
| 59 const string16& job_title, | 61 const string16& job_title, |
| 60 int preview_request_id); | 62 int preview_request_id); |
| 61 | 63 |
| 62 void OnReusePreviewData(int preview_request_id); | 64 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. | 105 // The number of print preview requests in flight. |
| 104 uint32 request_count_; | 106 uint32 request_count_; |
| 105 | 107 |
| 106 // Document cookie from the initiator renderer. | 108 // Document cookie from the initiator renderer. |
| 107 int document_cookie_; | 109 int document_cookie_; |
| 108 | 110 |
| 109 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 111 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 114 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |