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

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

Issue 8515017: Print Preview: Properly handle window.print(). (Closed)
Patch Set: fail instead of crash when 2 views both do window.print() Created 9 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 unified diff | Download patch
« no previous file with comments | « chrome/common/print_messages.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 Send(new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id())); 455 Send(new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id()));
456 return; 456 return;
457 } 457 }
458 458
459 if (IsScriptInitiatedPrintTooFrequent(frame)) 459 if (IsScriptInitiatedPrintTooFrequent(frame))
460 return; 460 return;
461 IncrementScriptedPrintCount(); 461 IncrementScriptedPrintCount();
462 462
463 if (is_preview_enabled_) { 463 if (is_preview_enabled_) {
464 print_preview_context_.InitWithFrame(frame); 464 print_preview_context_.InitWithFrame(frame);
465 RequestPrintPreview(); 465
466 old_print_pages_params_.reset(); // Same as in RequestPrintPreview().
467 IPC::SyncMessage* msg = new PrintHostMsg_ScriptedPrintPreview(routing_id());
468 msg->EnableMessagePumping();
469 Send(msg);
466 } else { 470 } else {
467 Print(frame, WebNode()); 471 Print(frame, WebNode());
468 } 472 }
469 } 473 }
470 474
471 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { 475 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
472 bool handled = true; 476 bool handled = true;
473 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) 477 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message)
474 IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) 478 IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
475 IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) 479 IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog)
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 DCHECK(IsRendering()); 1555 DCHECK(IsRendering());
1552 return prep_frame_view_->GetPrintCanvasSize(); 1556 return prep_frame_view_->GetPrintCanvasSize();
1553 } 1557 }
1554 1558
1555 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1559 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
1556 prep_frame_view_.reset(); 1560 prep_frame_view_.reset();
1557 metafile_.reset(); 1561 metafile_.reset();
1558 pages_to_render_.clear(); 1562 pages_to_render_.clear();
1559 error_ = PREVIEW_ERROR_NONE; 1563 error_ = PREVIEW_ERROR_NONE;
1560 } 1564 }
OLDNEW
« no previous file with comments | « chrome/common/print_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698