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

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

Issue 231793004: Update a few more references to WebFrame to use WebLocalFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 6 years, 8 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 canvas->scale(1 / webkit_scale_factor, 1 / webkit_scale_factor); 463 canvas->scale(1 / webkit_scale_factor, 1 / webkit_scale_factor);
464 464
465 blink::WebSize page_size(page_layout.margin_left + page_layout.margin_right + 465 blink::WebSize page_size(page_layout.margin_left + page_layout.margin_right +
466 page_layout.content_width, 466 page_layout.content_width,
467 page_layout.margin_top + page_layout.margin_bottom + 467 page_layout.margin_top + page_layout.margin_bottom +
468 page_layout.content_height); 468 page_layout.content_height);
469 469
470 blink::WebView* web_view = blink::WebView::create(NULL); 470 blink::WebView* web_view = blink::WebView::create(NULL);
471 web_view->settings()->setJavaScriptEnabled(true); 471 web_view->settings()->setJavaScriptEnabled(true);
472 472
473 blink::WebFrame* frame = blink::WebFrame::create(NULL); 473 blink::WebLocalFrame* frame = blink::WebLocalFrame::create(NULL);
474 web_view->setMainFrame(frame); 474 web_view->setMainFrame(frame);
475 475
476 base::StringValue html( 476 base::StringValue html(
477 ResourceBundle::GetSharedInstance().GetLocalizedString( 477 ResourceBundle::GetSharedInstance().GetLocalizedString(
478 IDR_PRINT_PREVIEW_PAGE)); 478 IDR_PRINT_PREVIEW_PAGE));
479 // Load page with script to avoid async operations. 479 // Load page with script to avoid async operations.
480 ExecuteScript(frame, kPageLoadScriptFormat, html); 480 ExecuteScript(frame, kPageLoadScriptFormat, html);
481 481
482 scoped_ptr<base::DictionaryValue> options(header_footer_info.DeepCopy()); 482 scoped_ptr<base::DictionaryValue> options(header_footer_info.DeepCopy());
483 options->SetDouble("width", page_size.width); 483 options->SetDouble("width", page_size.width);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // Create a new WebView with the same settings as the current display one. 685 // Create a new WebView with the same settings as the current display one.
686 // Except that we disable javascript (don't want any active content running 686 // Except that we disable javascript (don't want any active content running
687 // on the page). 687 // on the page).
688 WebPreferences prefs = preferences; 688 WebPreferences prefs = preferences;
689 prefs.javascript_enabled = false; 689 prefs.javascript_enabled = false;
690 prefs.java_enabled = false; 690 prefs.java_enabled = false;
691 691
692 blink::WebView* web_view = blink::WebView::create(this); 692 blink::WebView* web_view = blink::WebView::create(this);
693 owns_web_view_ = true; 693 owns_web_view_ = true;
694 content::ApplyWebPreferences(prefs, web_view); 694 content::ApplyWebPreferences(prefs, web_view);
695 web_view->setMainFrame(blink::WebFrame::create(this)); 695 web_view->setMainFrame(blink::WebLocalFrame::create(this));
696 frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); 696 frame_.Reset(web_view->mainFrame()->toWebLocalFrame());
697 node_to_print_.reset(); 697 node_to_print_.reset();
698 698
699 // When loading is done this will call didStopLoading() and that will do the 699 // When loading is done this will call didStopLoading() and that will do the
700 // actual printing. 700 // actual printing.
701 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); 701 frame()->loadRequest(blink::WebURLRequest(GURL(url_str)));
702 } 702 }
703 703
704 void PrepareFrameAndViewForPrint::didStopLoading() { 704 void PrepareFrameAndViewForPrint::didStopLoading() {
705 DCHECK(!on_ready_.is_null()); 705 DCHECK(!on_ready_.is_null());
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 } 1998 }
1999 1999
2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
2001 prep_frame_view_.reset(); 2001 prep_frame_view_.reset();
2002 metafile_.reset(); 2002 metafile_.reset();
2003 pages_to_render_.clear(); 2003 pages_to_render_.clear();
2004 error_ = PREVIEW_ERROR_NONE; 2004 error_ = PREVIEW_ERROR_NONE;
2005 } 2005 }
2006 2006
2007 } // namespace printing 2007 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/renderer/principals_extension_bindings.cc ('k') | chrome/renderer/searchbox/searchbox_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698