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

Unified Diff: chrome/renderer/printing/print_web_view_helper.h

Issue 12087005: Async frame preparation for Preview with support if selection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/mock_printer.cc ('k') | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/printing/print_web_view_helper.h
diff --git a/chrome/renderer/printing/print_web_view_helper.h b/chrome/renderer/printing/print_web_view_helper.h
index f75885c763cdadc0da7fcc1b4a70fd94846b4f1f..15107d43cd8b79d9863e44157a3f0e6c8c1ebeaf 100644
--- a/chrome/renderer/printing/print_web_view_helper.h
+++ b/chrome/renderer/printing/print_web_view_helper.h
@@ -138,6 +138,12 @@ class PrintWebViewHelper
// Start the process of generating a print preview using |settings|.
void OnPrintPreview(const base::DictionaryValue& settings);
+ // Prepare frame for creating preview document.
+ void PrepareFrameForPreviewDocument();
+
+ // Continue creating preview document.
+ void OnFramePreparedForPreviewDocument();
+
// Initialize the print preview document.
bool CreatePreviewDocument();
@@ -338,6 +344,8 @@ class PrintWebViewHelper
scoped_ptr<base::DictionaryValue> header_footer_info_;
// Keeps track of the state of print preview between messages.
+ // TODO(vitalybuka): Create PrintPreviewContext when needed and delete after
+ // use. Now it's interaction with veriouse messages is confusing.
Lei Zhang 2013/01/29 01:40:47 typo: veriouse -> various
Vitaly Buka (NO REVIEWS) 2013/01/29 05:14:57 Done.
class PrintPreviewContext {
public:
PrintPreviewContext();
@@ -352,9 +360,9 @@ class PrintWebViewHelper
void OnPrintPreview();
// Create the print preview document. |pages| is empty to print all pages.
- bool CreatePreviewDocument(const PrintMsg_Print_Params& params,
- const std::vector<int>& pages,
- bool ignore_css_margins);
+ // Takes ownership of |prepared_frame|.
+ bool CreatePreviewDocument(PrepareFrameAndViewForPrint* prepared_frame,
+ const std::vector<int>& pages);
// Called after a page gets rendered. |page_time| is how long the
// rendering took.
@@ -384,8 +392,18 @@ class PrintWebViewHelper
void set_error(enum PrintPreviewErrorBuckets error);
// Getters
- WebKit::WebFrame* frame();
- const WebKit::WebNode& node() const;
+ // Original frame for which preview was requested.
+ WebKit::WebFrame* source_frame();
+ // Original node for which preview was requested.
+ const WebKit::WebNode& source_node() const;
+
+ // Frame to be use to render preview. May be the same as source_frame(), or
+ // generated from it, e.g. copy of selected block.
+ WebKit::WebFrame* prepared_frame();
+ // Node to be use to render preview. May be the same as source_node(), or
+ // generated from it, e.g. copy of selected block.
+ const WebKit::WebNode& prepared_node() const;
+
int total_page_count() const;
bool generate_draft_pages() const;
PreviewMetafile* metafile();
@@ -404,8 +422,8 @@ class PrintWebViewHelper
void ClearContext();
// Specifies what to render for print preview.
- WebKit::WebFrame* frame_;
- WebKit::WebNode node_;
+ WebKit::WebFrame* source_frame_;
+ WebKit::WebNode source_node_;
scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
scoped_ptr<PreviewMetafile> metafile_;
« no previous file with comments | « chrome/renderer/mock_printer.cc ('k') | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698