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

Side by Side Diff: chrome/renderer/printing/print_web_view_helper.cc

Issue 488853002: Removed --disable-print-preview switch and policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/renderer/printing/print_web_view_helper.h" 5 #include "chrome/renderer/printing/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 393 }
394 394
395 if (fit_to_page) { 395 if (fit_to_page) {
396 double factor = FitPrintParamsToPage(params, &result_params); 396 double factor = FitPrintParamsToPage(params, &result_params);
397 if (scale_factor) 397 if (scale_factor)
398 *scale_factor = factor; 398 *scale_factor = factor;
399 } 399 }
400 return result_params; 400 return result_params;
401 } 401 }
402 402
403 bool IsPrintPreviewEnabled() {
404 return CommandLine::ForCurrentProcess()->HasSwitch(
405 switches::kRendererPrintPreview);
406 }
407
408 bool IsPrintThrottlingDisabled() {
409 return CommandLine::ForCurrentProcess()->HasSwitch(
410 switches::kDisableScriptedPrintThrottling);
411 }
412
413 } // namespace 403 } // namespace
414 404
415 FrameReference::FrameReference(blink::WebLocalFrame* frame) { 405 FrameReference::FrameReference(blink::WebLocalFrame* frame) {
416 Reset(frame); 406 Reset(frame);
417 } 407 }
418 408
419 FrameReference::FrameReference() { 409 FrameReference::FrameReference() {
420 Reset(NULL); 410 Reset(NULL);
421 } 411 }
422 412
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 764 }
775 } 765 }
776 frame_.Reset(NULL); 766 frame_.Reset(NULL);
777 on_ready_.Reset(); 767 on_ready_.Reset();
778 } 768 }
779 769
780 PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view) 770 PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view)
781 : content::RenderViewObserver(render_view), 771 : content::RenderViewObserver(render_view),
782 content::RenderViewObserverTracker<PrintWebViewHelper>(render_view), 772 content::RenderViewObserverTracker<PrintWebViewHelper>(render_view),
783 reset_prep_frame_view_(false), 773 reset_prep_frame_view_(false),
784 is_preview_enabled_(IsPrintPreviewEnabled()),
785 is_scripted_print_throttling_disabled_(IsPrintThrottlingDisabled()),
786 is_print_ready_metafile_sent_(false), 774 is_print_ready_metafile_sent_(false),
787 ignore_css_margins_(false), 775 ignore_css_margins_(false),
788 user_cancelled_scripted_print_count_(0),
789 is_scripted_printing_blocked_(false), 776 is_scripted_printing_blocked_(false),
790 notify_browser_of_print_failure_(true), 777 notify_browser_of_print_failure_(true),
791 print_for_preview_(false), 778 print_for_preview_(false),
792 print_node_in_progress_(false), 779 print_node_in_progress_(false),
793 is_loading_(false), 780 is_loading_(false),
794 is_scripted_preview_delayed_(false), 781 is_scripted_preview_delayed_(false),
795 weak_ptr_factory_(this) { 782 weak_ptr_factory_(this) {
796 } 783 }
797 784
798 PrintWebViewHelper::~PrintWebViewHelper() {} 785 PrintWebViewHelper::~PrintWebViewHelper() {}
799 786
800 bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed( 787 bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed(
801 blink::WebFrame* frame, bool user_initiated) { 788 blink::WebFrame* frame, bool user_initiated) {
802 #if defined(OS_ANDROID) 789 #if defined(OS_ANDROID)
803 return false; 790 return false;
804 #endif // defined(OS_ANDROID) 791 #endif // defined(OS_ANDROID)
805 if (is_scripted_printing_blocked_) 792 if (is_scripted_printing_blocked_)
806 return false; 793 return false;
807 // If preview is enabled, then the print dialog is tab modal, and the user
808 // can always close the tab on a mis-behaving page (the system print dialog
809 // is app modal). If the print was initiated through user action, don't
810 // throttle. Or, if the command line flag to skip throttling has been set.
811 if (!is_scripted_print_throttling_disabled_ &&
812 !is_preview_enabled_ &&
813 !user_initiated)
814 return !IsScriptInitiatedPrintTooFrequent(frame);
815 return true; 794 return true;
816 } 795 }
817 796
818 void PrintWebViewHelper::DidStartLoading() { 797 void PrintWebViewHelper::DidStartLoading() {
819 is_loading_ = true; 798 is_loading_ = true;
820 } 799 }
821 800
822 void PrintWebViewHelper::DidStopLoading() { 801 void PrintWebViewHelper::DidStopLoading() {
823 is_loading_ = false; 802 is_loading_ = false;
824 if (!on_stop_loading_closure_.is_null()) { 803 if (!on_stop_loading_closure_.is_null()) {
825 on_stop_loading_closure_.Run(); 804 on_stop_loading_closure_.Run();
826 on_stop_loading_closure_.Reset(); 805 on_stop_loading_closure_.Reset();
827 } 806 }
828 } 807 }
829 808
830 // Prints |frame| which called window.print(). 809 // Prints |frame| which called window.print().
831 void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame, 810 void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
832 bool user_initiated) { 811 bool user_initiated) {
833 DCHECK(frame); 812 DCHECK(frame);
834 813
835 // Allow Prerendering to cancel this print request if necessary. 814 // Allow Prerendering to cancel this print request if necessary.
836 if (prerender::PrerenderHelper::IsPrerendering( 815 if (prerender::PrerenderHelper::IsPrerendering(
837 render_view()->GetMainRenderFrame())) { 816 render_view()->GetMainRenderFrame())) {
838 Send(new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id())); 817 Send(new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id()));
839 return; 818 return;
840 } 819 }
841 820
842 if (!IsScriptInitiatedPrintAllowed(frame, user_initiated)) 821 if (!IsScriptInitiatedPrintAllowed(frame, user_initiated))
843 return; 822 return;
844 IncrementScriptedPrintCount(); 823 print_preview_context_.InitWithFrame(frame);
845 824 RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
846 if (is_preview_enabled_) {
847 print_preview_context_.InitWithFrame(frame);
848 RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
849 } else {
850 Print(frame, blink::WebNode());
851 }
852 } 825 }
853 826
854 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { 827 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
855 bool handled = true; 828 bool handled = true;
856 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) 829 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message)
857 IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) 830 IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
858 IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) 831 IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog)
859 IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview) 832 IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview)
860 IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview) 833 IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
861 IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview) 834 IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview)
862 IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone) 835 IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone)
863 IPC_MESSAGE_HANDLER(PrintMsg_ResetScriptedPrintCount,
864 ResetScriptedPrintCount)
865 IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked, 836 IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked,
866 SetScriptedPrintBlocked) 837 SetScriptedPrintBlocked)
867 IPC_MESSAGE_UNHANDLED(handled = false) 838 IPC_MESSAGE_UNHANDLED(handled = false)
868 IPC_END_MESSAGE_MAP() 839 IPC_END_MESSAGE_MAP()
869 return handled; 840 return handled;
870 } 841 }
871 842
872 void PrintWebViewHelper::OnPrintForPrintPreview( 843 void PrintWebViewHelper::OnPrintForPrintPreview(
873 const base::DictionaryValue& job_settings) { 844 const base::DictionaryValue& job_settings) {
874 DCHECK(is_preview_enabled_);
875 // If still not finished with earlier print request simply ignore. 845 // If still not finished with earlier print request simply ignore.
876 if (prep_frame_view_) 846 if (prep_frame_view_)
877 return; 847 return;
878 848
879 if (!render_view()->GetWebView()) 849 if (!render_view()->GetWebView())
880 return; 850 return;
881 blink::WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); 851 blink::WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
882 if (!main_frame) 852 if (!main_frame)
883 return; 853 return;
884 854
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 968
999 bool PrintWebViewHelper::IsPrintToPdfRequested( 969 bool PrintWebViewHelper::IsPrintToPdfRequested(
1000 const base::DictionaryValue& job_settings) { 970 const base::DictionaryValue& job_settings) {
1001 bool print_to_pdf = false; 971 bool print_to_pdf = false;
1002 if (!job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf)) 972 if (!job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf))
1003 NOTREACHED(); 973 NOTREACHED();
1004 return print_to_pdf; 974 return print_to_pdf;
1005 } 975 }
1006 976
1007 void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { 977 void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
1008 DCHECK(is_preview_enabled_);
1009 print_preview_context_.OnPrintPreview(); 978 print_preview_context_.OnPrintPreview();
1010 979
1011 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent", 980 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent",
1012 PREVIEW_EVENT_REQUESTED, PREVIEW_EVENT_MAX); 981 PREVIEW_EVENT_REQUESTED, PREVIEW_EVENT_MAX);
1013 982
1014 if (!print_preview_context_.source_frame()) { 983 if (!print_preview_context_.source_frame()) {
1015 DidFinishPrinting(FAIL_PREVIEW); 984 DidFinishPrinting(FAIL_PREVIEW);
1016 return; 985 return;
1017 } 986 }
1018 987
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 if (!success) 1170 if (!success)
1202 LOG(ERROR) << "Failure in OnPrintingDone"; 1171 LOG(ERROR) << "Failure in OnPrintingDone";
1203 DidFinishPrinting(success ? OK : FAIL_PRINT); 1172 DidFinishPrinting(success ? OK : FAIL_PRINT);
1204 } 1173 }
1205 1174
1206 void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) { 1175 void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) {
1207 is_scripted_printing_blocked_ = blocked; 1176 is_scripted_printing_blocked_ = blocked;
1208 } 1177 }
1209 1178
1210 void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { 1179 void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
1211 DCHECK(is_preview_enabled_);
1212 blink::WebLocalFrame* frame = NULL; 1180 blink::WebLocalFrame* frame = NULL;
1213 GetPrintFrame(&frame); 1181 GetPrintFrame(&frame);
1214 DCHECK(frame); 1182 DCHECK(frame);
1215 print_preview_context_.InitWithFrame(frame); 1183 print_preview_context_.InitWithFrame(frame);
1216 RequestPrintPreview(selection_only ? 1184 RequestPrintPreview(selection_only ?
1217 PRINT_PREVIEW_USER_INITIATED_SELECTION : 1185 PRINT_PREVIEW_USER_INITIATED_SELECTION :
1218 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); 1186 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME);
1219 } 1187 }
1220 1188
1221 bool PrintWebViewHelper::IsPrintingEnabled() { 1189 bool PrintWebViewHelper::IsPrintingEnabled() {
(...skipping 13 matching lines...) Expand all
1235 // This can happen as a result of processing sync messages when printing 1203 // This can happen as a result of processing sync messages when printing
1236 // from ppapi plugins. It's a rare case, so its OK to just fail here. 1204 // from ppapi plugins. It's a rare case, so its OK to just fail here.
1237 // See http://crbug.com/159165. 1205 // See http://crbug.com/159165.
1238 return; 1206 return;
1239 } 1207 }
1240 1208
1241 print_node_in_progress_ = true; 1209 print_node_in_progress_ = true;
1242 1210
1243 // Make a copy of the node, in case RenderView::OnContextMenuClosed resets 1211 // Make a copy of the node, in case RenderView::OnContextMenuClosed resets
1244 // its |context_menu_node_|. 1212 // its |context_menu_node_|.
1245 if (is_preview_enabled_) { 1213 print_preview_context_.InitWithNode(node);
1246 print_preview_context_.InitWithNode(node); 1214 RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
1247 RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
1248 } else {
1249 blink::WebNode duplicate_node(node);
1250 Print(duplicate_node.document().frame(), duplicate_node);
1251 }
1252 1215
1253 print_node_in_progress_ = false; 1216 print_node_in_progress_ = false;
1254 } 1217 }
1255 1218
1256 void PrintWebViewHelper::Print(blink::WebLocalFrame* frame, 1219 void PrintWebViewHelper::Print(blink::WebLocalFrame* frame,
1257 const blink::WebNode& node) { 1220 const blink::WebNode& node) {
1258 // If still not finished with earlier print request simply ignore. 1221 // If still not finished with earlier print request simply ignore.
1259 if (prep_frame_view_) 1222 if (prep_frame_view_)
1260 return; 1223 return;
1261 1224
(...skipping 16 matching lines...) Expand all
1278 expected_page_count)) { 1241 expected_page_count)) {
1279 DidFinishPrinting(OK); // Release resources and fail silently. 1242 DidFinishPrinting(OK); // Release resources and fail silently.
1280 return; 1243 return;
1281 } 1244 }
1282 1245
1283 // Render Pages for printing. 1246 // Render Pages for printing.
1284 if (!RenderPagesForPrint(frame_ref.GetFrame(), node)) { 1247 if (!RenderPagesForPrint(frame_ref.GetFrame(), node)) {
1285 LOG(ERROR) << "RenderPagesForPrint failed"; 1248 LOG(ERROR) << "RenderPagesForPrint failed";
1286 DidFinishPrinting(FAIL_PRINT); 1249 DidFinishPrinting(FAIL_PRINT);
1287 } 1250 }
1288 ResetScriptedPrintCount();
1289 } 1251 }
1290 1252
1291 void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { 1253 void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
1292 switch (result) { 1254 switch (result) {
1293 case OK: 1255 case OK:
1294 break; 1256 break;
1295 1257
1296 case FAIL_PRINT_INIT: 1258 case FAIL_PRINT_INIT:
1297 DCHECK(!notify_browser_of_print_failure_); 1259 DCHECK(!notify_browser_of_print_failure_);
1298 break; 1260 break;
1299 1261
1300 case FAIL_PRINT: 1262 case FAIL_PRINT:
1301 if (notify_browser_of_print_failure_ && print_pages_params_) { 1263 if (notify_browser_of_print_failure_ && print_pages_params_) {
1302 int cookie = print_pages_params_->params.document_cookie; 1264 int cookie = print_pages_params_->params.document_cookie;
1303 Send(new PrintHostMsg_PrintingFailed(routing_id(), cookie)); 1265 Send(new PrintHostMsg_PrintingFailed(routing_id(), cookie));
1304 } 1266 }
1305 break; 1267 break;
1306 1268
1307 case FAIL_PREVIEW: 1269 case FAIL_PREVIEW:
1308 DCHECK(is_preview_enabled_);
1309 int cookie = print_pages_params_ ? 1270 int cookie = print_pages_params_ ?
1310 print_pages_params_->params.document_cookie : 0; 1271 print_pages_params_->params.document_cookie : 0;
1311 if (notify_browser_of_print_failure_) { 1272 if (notify_browser_of_print_failure_) {
1312 LOG(ERROR) << "CreatePreviewDocument failed"; 1273 LOG(ERROR) << "CreatePreviewDocument failed";
1313 Send(new PrintHostMsg_PrintPreviewFailed(routing_id(), cookie)); 1274 Send(new PrintHostMsg_PrintPreviewFailed(routing_id(), cookie));
1314 } else { 1275 } else {
1315 Send(new PrintHostMsg_PrintPreviewCancelled(routing_id(), cookie)); 1276 Send(new PrintHostMsg_PrintPreviewCancelled(routing_id(), cookie));
1316 } 1277 }
1317 print_preview_context_.Failed(notify_browser_of_print_failure_); 1278 print_preview_context_.Failed(notify_browser_of_print_failure_);
1318 break; 1279 break;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 const blink::WebNode& source_node = print_preview_context_.source_node(); 1428 const blink::WebNode& source_node = print_preview_context_.source_node();
1468 1429
1469 params.is_scaling_disabled = 1430 params.is_scaling_disabled =
1470 source_frame->isPrintScalingDisabledForPlugin(source_node); 1431 source_frame->isPrintScalingDisabledForPlugin(source_node);
1471 } 1432 }
1472 1433
1473 bool PrintWebViewHelper::UpdatePrintSettings( 1434 bool PrintWebViewHelper::UpdatePrintSettings(
1474 blink::WebLocalFrame* frame, 1435 blink::WebLocalFrame* frame,
1475 const blink::WebNode& node, 1436 const blink::WebNode& node,
1476 const base::DictionaryValue& passed_job_settings) { 1437 const base::DictionaryValue& passed_job_settings) {
1477 DCHECK(is_preview_enabled_);
1478 const base::DictionaryValue* job_settings = &passed_job_settings; 1438 const base::DictionaryValue* job_settings = &passed_job_settings;
1479 base::DictionaryValue modified_job_settings; 1439 base::DictionaryValue modified_job_settings;
1480 if (job_settings->empty()) { 1440 if (job_settings->empty()) {
1481 if (!print_for_preview_) 1441 if (!print_for_preview_)
1482 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); 1442 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING);
1483 return false; 1443 return false;
1484 } 1444 }
1485 1445
1486 bool source_is_html = true; 1446 bool source_is_html = true;
1487 if (print_for_preview_) { 1447 if (print_for_preview_) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 if (shared_buf->Map(buf_size)) { 1576 if (shared_buf->Map(buf_size)) {
1617 metafile->GetData(shared_buf->memory(), buf_size); 1577 metafile->GetData(shared_buf->memory(), buf_size);
1618 return shared_buf->GiveToProcess(base::GetCurrentProcessHandle(), 1578 return shared_buf->GiveToProcess(base::GetCurrentProcessHandle(),
1619 shared_mem_handle); 1579 shared_mem_handle);
1620 } 1580 }
1621 } 1581 }
1622 return false; 1582 return false;
1623 } 1583 }
1624 #endif // defined(OS_POSIX) 1584 #endif // defined(OS_POSIX)
1625 1585
1626 bool PrintWebViewHelper::IsScriptInitiatedPrintTooFrequent(
1627 blink::WebFrame* frame) {
1628 const int kMinSecondsToIgnoreJavascriptInitiatedPrint = 2;
1629 const int kMaxSecondsToIgnoreJavascriptInitiatedPrint = 32;
1630 bool too_frequent = false;
1631
1632 // Check if there is script repeatedly trying to print and ignore it if too
1633 // frequent. The first 3 times, we use a constant wait time, but if this
1634 // gets excessive, we switch to exponential wait time. So for a page that
1635 // calls print() in a loop the user will need to cancel the print dialog
1636 // after: [2, 2, 2, 4, 8, 16, 32, 32, ...] seconds.
1637 // This gives the user time to navigate from the page.
1638 if (user_cancelled_scripted_print_count_ > 0) {
1639 base::TimeDelta diff = base::Time::Now() - last_cancelled_script_print_;
1640 int min_wait_seconds = kMinSecondsToIgnoreJavascriptInitiatedPrint;
1641 if (user_cancelled_scripted_print_count_ > 3) {
1642 min_wait_seconds = std::min(
1643 kMinSecondsToIgnoreJavascriptInitiatedPrint <<
1644 (user_cancelled_scripted_print_count_ - 3),
1645 kMaxSecondsToIgnoreJavascriptInitiatedPrint);
1646 }
1647 if (diff.InSeconds() < min_wait_seconds) {
1648 too_frequent = true;
1649 }
1650 }
1651
1652 if (!too_frequent)
1653 return false;
1654
1655 blink::WebString message(
1656 blink::WebString::fromUTF8("Ignoring too frequent calls to print()."));
1657 frame->addMessageToConsole(
1658 blink::WebConsoleMessage(
1659 blink::WebConsoleMessage::LevelWarning, message));
1660 return true;
1661 }
1662
1663 void PrintWebViewHelper::ResetScriptedPrintCount() {
1664 // Reset cancel counter on successful print.
1665 user_cancelled_scripted_print_count_ = 0;
1666 }
1667
1668 void PrintWebViewHelper::IncrementScriptedPrintCount() {
1669 ++user_cancelled_scripted_print_count_;
1670 last_cancelled_script_print_ = base::Time::Now();
1671 }
1672
1673
1674 void PrintWebViewHelper::ShowScriptedPrintPreview() { 1586 void PrintWebViewHelper::ShowScriptedPrintPreview() {
1675 if (is_scripted_preview_delayed_) { 1587 if (is_scripted_preview_delayed_) {
1676 is_scripted_preview_delayed_ = false; 1588 is_scripted_preview_delayed_ = false;
1677 Send(new PrintHostMsg_ShowScriptedPrintPreview(routing_id(), 1589 Send(new PrintHostMsg_ShowScriptedPrintPreview(routing_id(),
1678 print_preview_context_.IsModifiable())); 1590 print_preview_context_.IsModifiable()));
1679 } 1591 }
1680 } 1592 }
1681 1593
1682 void PrintWebViewHelper::RequestPrintPreview(PrintPreviewRequestType type) { 1594 void PrintWebViewHelper::RequestPrintPreview(PrintPreviewRequestType type) {
1683 const bool is_modifiable = print_preview_context_.IsModifiable(); 1595 const bool is_modifiable = print_preview_context_.IsModifiable();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 } 1959 }
2048 1960
2049 void PrintWebViewHelper::SetPrintPagesParams( 1961 void PrintWebViewHelper::SetPrintPagesParams(
2050 const PrintMsg_PrintPages_Params& settings) { 1962 const PrintMsg_PrintPages_Params& settings) {
2051 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); 1963 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings));
2052 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), 1964 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(),
2053 settings.params.document_cookie)); 1965 settings.params.document_cookie));
2054 } 1966 }
2055 1967
2056 } // namespace printing 1968 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/renderer/printing/print_web_view_helper.h ('k') | chrome/renderer/printing/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698