| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 335 } |
| 336 | 336 |
| 337 PrintWebViewHelper::~PrintWebViewHelper() {} | 337 PrintWebViewHelper::~PrintWebViewHelper() {} |
| 338 | 338 |
| 339 // Prints |frame| which called window.print(). | 339 // Prints |frame| which called window.print(). |
| 340 void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame) { | 340 void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame) { |
| 341 DCHECK(frame); | 341 DCHECK(frame); |
| 342 | 342 |
| 343 // Allow Prerendering to cancel this print request if necessary. | 343 // Allow Prerendering to cancel this print request if necessary. |
| 344 if (prerender::PrerenderHelper::IsPrerendering(render_view())) { | 344 if (prerender::PrerenderHelper::IsPrerendering(render_view())) { |
| 345 Send(new ViewHostMsg_CancelPrerenderForPrinting(routing_id())); | 345 Send(new ChromeViewHostMsg_CancelPrerenderForPrinting(routing_id())); |
| 346 return; | 346 return; |
| 347 } | 347 } |
| 348 | 348 |
| 349 if (IsScriptInitiatedPrintTooFrequent(frame)) | 349 if (IsScriptInitiatedPrintTooFrequent(frame)) |
| 350 return; | 350 return; |
| 351 IncrementScriptedPrintCount(); | 351 IncrementScriptedPrintCount(); |
| 352 | 352 |
| 353 if (is_preview_) { | 353 if (is_preview_) { |
| 354 print_preview_context_.InitWithFrame(frame); | 354 print_preview_context_.InitWithFrame(frame); |
| 355 RequestPrintPreview(); | 355 RequestPrintPreview(); |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 const gfx::Size& | 1295 const gfx::Size& |
| 1296 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { | 1296 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { |
| 1297 return prep_frame_view_->GetPrintCanvasSize(); | 1297 return prep_frame_view_->GetPrintCanvasSize(); |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1300 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 1301 prep_frame_view_.reset(); | 1301 prep_frame_view_.reset(); |
| 1302 metafile_.reset(); | 1302 metafile_.reset(); |
| 1303 rendered_pages_.clear(); | 1303 rendered_pages_.clear(); |
| 1304 } | 1304 } |
| OLD | NEW |