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