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

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

Issue 7063030: PrintPreview: Print Preview is not staying associated with initiator renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed thestig@ comments. 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"
13 #include "chrome/browser/printing/print_preview_data_service.h"
Lei Zhang 2011/05/29 00:24:23 forward declare instead?
kmadhusu 2011/05/29 00:45:40 Done.
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 // PrintPreviewDataService is valid and SetPrintPreviewData() does not get
23 // called.
24 void GetPrintPreviewData(scoped_refptr<RefCountedBytes>* data);
25
26 // Sets the print preview |data|.
27 void SetPrintPreviewData(const RefCountedBytes* data);
22 28
23 // Notify the Web UI renderer that preview data is available. 29 // Notify the Web UI renderer that preview data is available.
24 // |expected_pages_count| specifies the total number of pages. 30 // |expected_pages_count| specifies the total number of pages.
25 // |job_title| is the title of the page being previewed. 31 // |job_title| is the title of the page being previewed.
26 // |modifiable| indicates if the preview can be rerendered with different 32 // |modifiable| indicates if the preview can be rerendered with different
27 // print settings. 33 // print settings.
28 void OnPreviewDataIsAvailable(int expected_pages_count, 34 void OnPreviewDataIsAvailable(int expected_pages_count,
29 const string16& job_title, 35 const string16& job_title,
30 bool modifiable); 36 bool modifiable);
31 37
32 // Notify the Web UI that initiator tab is closed, so we can disable all 38 // 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. 39 // 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 40 // |initiator_tab_url| is passed in order to display a more accurate error
35 // message. 41 // message.
36 void OnInitiatorTabClosed(const std::string& initiator_tab_url); 42 void OnInitiatorTabClosed(const std::string& initiator_tab_url);
37 43
38 private: 44 private:
39 scoped_refptr<PrintPreviewUIHTMLSource> html_source_; 45 // Helper function
46 PrintPreviewDataService* print_preview_data_service();
47
48 // Store the PrintPreviewUI address string.
49 std::string preview_ui_addr_str_;
40 50
41 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 51 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
42 }; 52 };
43 53
44 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 54 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698