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

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

Issue 175543005: Use the single argument overload of WebFrame::create(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 canvas->scale(1 / webkit_scale_factor, 1 / webkit_scale_factor); 458 canvas->scale(1 / webkit_scale_factor, 1 / webkit_scale_factor);
459 459
460 blink::WebSize page_size(page_layout.margin_left + page_layout.margin_right + 460 blink::WebSize page_size(page_layout.margin_left + page_layout.margin_right +
461 page_layout.content_width, 461 page_layout.content_width,
462 page_layout.margin_top + page_layout.margin_bottom + 462 page_layout.margin_top + page_layout.margin_bottom +
463 page_layout.content_height); 463 page_layout.content_height);
464 464
465 blink::WebView* web_view = blink::WebView::create(NULL); 465 blink::WebView* web_view = blink::WebView::create(NULL);
466 web_view->settings()->setJavaScriptEnabled(true); 466 web_view->settings()->setJavaScriptEnabled(true);
467 467
468 // We don't need to use the frame ID for this frame, so we pass 0 for it. 468 blink::WebFrame* frame = blink::WebFrame::create(NULL);
469 blink::WebFrame* frame = blink::WebFrame::create(NULL, 0);
470 web_view->setMainFrame(frame); 469 web_view->setMainFrame(frame);
471 470
472 base::StringValue html( 471 base::StringValue html(
473 ResourceBundle::GetSharedInstance().GetLocalizedString( 472 ResourceBundle::GetSharedInstance().GetLocalizedString(
474 IDR_PRINT_PREVIEW_PAGE)); 473 IDR_PRINT_PREVIEW_PAGE));
475 // Load page with script to avoid async operations. 474 // Load page with script to avoid async operations.
476 ExecuteScript(frame, kPageLoadScriptFormat, html); 475 ExecuteScript(frame, kPageLoadScriptFormat, html);
477 476
478 scoped_ptr<base::DictionaryValue> options(header_footer_info.DeepCopy()); 477 scoped_ptr<base::DictionaryValue> options(header_footer_info.DeepCopy());
479 options->SetDouble("width", page_size.width); 478 options->SetDouble("width", page_size.width);
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 } 1997 }
1999 1998
2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1999 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
2001 prep_frame_view_.reset(); 2000 prep_frame_view_.reset();
2002 metafile_.reset(); 2001 metafile_.reset();
2003 pages_to_render_.clear(); 2002 pages_to_render_.clear();
2004 error_ = PREVIEW_ERROR_NONE; 2003 error_ = PREVIEW_ERROR_NONE;
2005 } 2004 }
2006 2005
2007 } // namespace printing 2006 } // namespace printing
OLDNEW
« no previous file with comments | « android_webview/renderer/print_web_view_helper.cc ('k') | components/plugins/renderer/webview_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698