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 "content/browser/webui/web_ui.h" | 13 #include "content/browser/webui/web_ui.h" |
13 | 14 |
14 class PrintPreviewUIHTMLSource; | |
15 | |
16 class PrintPreviewUI : public WebUI { | 15 class PrintPreviewUI : public WebUI { |
17 public: | 16 public: |
18 explicit PrintPreviewUI(TabContents* contents); | 17 explicit PrintPreviewUI(TabContents* contents); |
19 virtual ~PrintPreviewUI(); | 18 virtual ~PrintPreviewUI(); |
20 | 19 |
21 PrintPreviewUIHTMLSource* html_source(); | 20 // Gets the print preview |data|. The data is valid as long as the |
| 21 // PrintPreviewDataService is valid and SetPrintPreviewData() does not get |
| 22 // called. |
| 23 void GetPrintPreviewData(scoped_refptr<RefCountedBytes>* data); |
| 24 |
| 25 // Sets the print preview |data|. |
| 26 void SetPrintPreviewData(const RefCountedBytes* data); |
22 | 27 |
23 // Notify the Web UI renderer that preview data is available. | 28 // Notify the Web UI renderer that preview data is available. |
24 // |expected_pages_count| specifies the total number of pages. | 29 // |expected_pages_count| specifies the total number of pages. |
25 // |job_title| is the title of the page being previewed. | 30 // |job_title| is the title of the page being previewed. |
26 // |modifiable| indicates if the preview can be rerendered with different | 31 // |modifiable| indicates if the preview can be rerendered with different |
27 // print settings. | 32 // print settings. |
28 void OnPreviewDataIsAvailable(int expected_pages_count, | 33 void OnPreviewDataIsAvailable(int expected_pages_count, |
29 const string16& job_title, | 34 const string16& job_title, |
30 bool modifiable); | 35 bool modifiable); |
31 | 36 |
32 // Notify the Web UI that initiator tab is closed, so we can disable all | 37 // Notify the Web UI that initiator tab is closed, so we can disable all |
33 // the controls that need the initiator tab for generating the preview data. | 38 // the controls that need the initiator tab for generating the preview data. |
34 // |initiator_tab_url| is passed in order to display a more accurate error | 39 // |initiator_tab_url| is passed in order to display a more accurate error |
35 // message. | 40 // message. |
36 void OnInitiatorTabClosed(const std::string& initiator_tab_url); | 41 void OnInitiatorTabClosed(const std::string& initiator_tab_url); |
37 | 42 |
38 private: | 43 private: |
39 scoped_refptr<PrintPreviewUIHTMLSource> html_source_; | 44 // Store the PrintPreviewUI address string. |
| 45 std::string preview_ui_addr_str_; |
40 | 46 |
41 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 47 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
42 }; | 48 }; |
43 | 49 |
44 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ | 50 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ |
OLD | NEW |