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

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 3f7e1b5d5b374db3f823011a25bbbe348485f1a5..267b74bfc7f5a9ea8b2d0f276586d87d90b67a41 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -93,6 +93,7 @@ class PrintWebViewHelper : public RenderViewObserver ,
void OnPrintPages();
void OnPrintPreview();
void OnPrintNodeUnderContextMenu();
+ void OnPrintForPrintPreview(const std::string& job_settings);
protected:
bool CopyAndPrint(WebKit::WebFrame* web_frame);
@@ -120,6 +121,11 @@ class PrintWebViewHelper : public RenderViewObserver ,
virtual void didStopLoading();
private:
+ enum GetSettingsParam {
+ DEFAULT,
+ CURRENT,
+ };
+
static void GetPageSizeAndMarginsInPoints(
WebKit::WebFrame* frame,
int page_index,
@@ -139,11 +145,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 +167,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