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

Unified Diff: chrome/renderer/print_web_view_helper.h

Issue 6533006: Print Preview: Hook up the print button to initiate printing without displaying a print dialog. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 10 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
Index: chrome/renderer/print_web_view_helper.h
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index d08e39232488df495c066b7563aedd3480956cb5..1953909587d595b299d16d25445466f7b36703b7 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -89,7 +89,7 @@ class PrintWebViewHelper : public RenderViewObserver ,
// Message handlers. Public for testing.
void OnPrintingDone(int document_cookie, bool success);
- void OnPrintForPrintPreview();
+ void OnPrintForPrintPreview(const std::string& job_settings);
void OnPrintPages();
void OnPrintPreview();
void OnPrintNodeUnderContextMenu();
@@ -120,6 +120,11 @@ class PrintWebViewHelper : public RenderViewObserver ,
virtual void didStopLoading();
private:
+ enum GetSettingsParam {
+ DEFAULT,
Lei Zhang 2011/02/18 05:21:42 Do you intend to have more types in this enum? If
kmadhusu 2011/02/21 01:30:26 Just for readability and better understanding of t
+ CURRENT,
+ };
+
static void GetPageSizeAndMarginsInPoints(
WebKit::WebFrame* frame,
int page_index,
@@ -139,11 +144,17 @@ class PrintWebViewHelper : public RenderViewObserver ,
void PrintNode(WebKit::WebNode* node,
bool script_initiated,
- bool is_preview);
+ bool is_preview,
+ bool is_print_for_print_preview);
// Notification when printing is done - signal teardown
void DidFinishPrinting(bool success);
+ // Print the pages for print preview. Do not display the native print dialog
+ // for user settings. Use the current print settings set by the user in
+ // preview tab.
+ void PrintForPrintPreview(WebKit::WebFrame* frame, WebKit::WebNode* node);
+
void Print(WebKit::WebFrame* frame,
WebKit::WebNode* node,
bool script_initiated,
@@ -155,12 +166,20 @@ class PrintWebViewHelper : public RenderViewObserver ,
// Initialize print page settings with default settings.
bool InitPrintSettings(WebKit::WebFrame* frame,
- WebKit::WebNode* node);
-
- // Get the default printer settings.
- bool GetDefaultPrintSettings(WebKit::WebFrame* frame,
- WebKit::WebNode* node,
- ViewMsg_Print_Params* params);
+ WebKit::WebNode* node,
+ GetSettingsParam setting_type);
+
+ // Update the current print settings with new |job_settings|. |job_settings|
+ // is a json string which contains print job details such as printer name,
+ // number of copies, page range, etc.
+ bool UpdatePrintSettings(const std::string& job_settings);
+
+ // Get the print settings. |setting_type| determines whether we need to get
+ // current settings or default settings.
+ bool GetPrintSettings(WebKit::WebFrame* frame,
+ WebKit::WebNode* node,
+ GetSettingsParam setting_type,
+ ViewMsg_Print_Params* params);
// Get final print settings from the user.
// Return false if the user cancels or on error.

Powered by Google App Engine
This is Rietveld 408576698