OLD | NEW |
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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 465 |
466 old_print_pages_params_.reset(); // Same as in RequestPrintPreview(). | 466 old_print_pages_params_.reset(); // Same as in RequestPrintPreview(). |
467 IPC::SyncMessage* msg = new PrintHostMsg_ScriptedPrintPreview(routing_id()); | 467 IPC::SyncMessage* msg = new PrintHostMsg_ScriptedPrintPreview( |
| 468 routing_id(), |
| 469 print_preview_context_.IsModifiable()); |
468 msg->EnableMessagePumping(); | 470 msg->EnableMessagePumping(); |
469 Send(msg); | 471 Send(msg); |
470 } else { | 472 } else { |
471 Print(frame, WebNode()); | 473 Print(frame, WebNode()); |
472 } | 474 } |
473 } | 475 } |
474 | 476 |
475 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { | 477 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { |
476 bool handled = true; | 478 bool handled = true; |
477 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) | 479 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 DCHECK(IsRendering()); | 1557 DCHECK(IsRendering()); |
1556 return prep_frame_view_->GetPrintCanvasSize(); | 1558 return prep_frame_view_->GetPrintCanvasSize(); |
1557 } | 1559 } |
1558 | 1560 |
1559 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1561 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
1560 prep_frame_view_.reset(); | 1562 prep_frame_view_.reset(); |
1561 metafile_.reset(); | 1563 metafile_.reset(); |
1562 pages_to_render_.clear(); | 1564 pages_to_render_.clear(); |
1563 error_ = PREVIEW_ERROR_NONE; | 1565 error_ = PREVIEW_ERROR_NONE; |
1564 } | 1566 } |
OLD | NEW |