Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/ui/webui/print_preview_ui.h

Issue 7082032: Preview tab data source. (Sample CL) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 class PrintPreviewDataService;
15 16
16 class PrintPreviewUI : public WebUI { 17 class PrintPreviewUI : public WebUI {
17 public: 18 public:
18 explicit PrintPreviewUI(TabContents* contents); 19 explicit PrintPreviewUI(TabContents* contents);
19 virtual ~PrintPreviewUI(); 20 virtual ~PrintPreviewUI();
20 21
21 PrintPreviewUIHTMLSource* html_source(); 22 // Gets the print preview |data|. The data is valid as long as the
23 // PrintPreviewDataService is valid and SetPrintPreviewData() does not get
24 // called.
25 void GetPrintPreviewData(scoped_refptr<RefCountedBytes>* data);
26
27 // Sets the print preview |data|.
28 void SetPrintPreviewData(const RefCountedBytes* 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 // Helper function
47 PrintPreviewDataService* print_preview_data_service();
40 48
41 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 49 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
42 }; 50 };
43 51
44 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 52 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | chrome/browser/ui/webui/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698