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

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

Issue 740983002: Implement window.print() on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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/printing/print_web_view_helper.cc
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc
index 201e4c25cfc9c3bcd65485912053db37fa698538..7f3761f23cedadadf3ec9830febc5e9f5e758450 100644
--- a/chrome/renderer/printing/print_web_view_helper.cc
+++ b/chrome/renderer/printing/print_web_view_helper.cc
@@ -818,9 +818,6 @@ void PrintWebViewHelper::DisablePreview() {
bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed(
blink::WebFrame* frame, bool user_initiated) {
-#if defined(OS_ANDROID)
- return false;
-#endif // defined(OS_ANDROID)
// If preview is enabled, then the print dialog is tab modal, and the user
// can always close the tab on a mis-behaving page (the system print dialog
// is app modal). If the print was initiated through user action, don't
@@ -858,7 +855,11 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
return;
if (!g_is_preview_enabled_) {
- Print(frame, blink::WebNode());
+#if defined(OS_ANDROID)
+ Print(frame, blink::WebNode(), true);
+#else
Vitaly Buka (NO REVIEWS) 2014/12/12 08:37:17 set true for all platforms, and use if def on brow
dgn 2014/12/12 16:49:44 I will still have to use if def to send false when
+ Print(frame, blink::WebNode(), false);
+#endif
} else {
print_preview_context_.InitWithFrame(frame);
RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
@@ -1275,7 +1276,8 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
}
void PrintWebViewHelper::Print(blink::WebLocalFrame* frame,
- const blink::WebNode& node) {
+ const blink::WebNode& node,
+ const bool use_system_specific_flow) {
Vitaly Buka (NO REVIEWS) 2014/12/12 08:37:17 let's call this argn and IPC is_scripted or someth
dgn 2014/12/12 16:49:44 Done.
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
@@ -1296,7 +1298,8 @@ void PrintWebViewHelper::Print(blink::WebLocalFrame* frame,
// Ask the browser to show UI to retrieve the final print settings.
if (!GetPrintSettingsFromUser(frame_ref.GetFrame(), node,
- expected_page_count)) {
+ expected_page_count,
+ use_system_specific_flow)) {
DidFinishPrinting(OK); // Release resources and fail silently.
return;
}
@@ -1573,7 +1576,8 @@ bool PrintWebViewHelper::UpdatePrintSettings(
bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebFrame* frame,
const blink::WebNode& node,
- int expected_pages_count) {
+ int expected_pages_count,
+ const bool system_specific) {
PrintHostMsg_ScriptedPrint_Params params;
PrintMsg_PrintPages_Params print_settings;
@@ -1584,6 +1588,7 @@ bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebFrame* frame,
if (PrintingNodeOrPdfFrame(frame, node))
margin_type = GetMarginsForPdf(frame, node);
params.margin_type = margin_type;
+ params.use_system_specific_flow = system_specific;
Send(new PrintHostMsg_DidShowPrintDialog(routing_id()));

Powered by Google App Engine
This is Rietveld 408576698