OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 | 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 |
6 | 6 |
7 #include "android_webview/renderer/print_web_view_helper.h" | 7 #include "android_webview/renderer/print_web_view_helper.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 // Create a new WebView with the same settings as the current display one. | 647 // Create a new WebView with the same settings as the current display one. |
648 // Except that we disable javascript (don't want any active content running | 648 // Except that we disable javascript (don't want any active content running |
649 // on the page). | 649 // on the page). |
650 WebPreferences prefs = preferences; | 650 WebPreferences prefs = preferences; |
651 prefs.javascript_enabled = false; | 651 prefs.javascript_enabled = false; |
652 prefs.java_enabled = false; | 652 prefs.java_enabled = false; |
653 | 653 |
654 blink::WebView* web_view = blink::WebView::create(this); | 654 blink::WebView* web_view = blink::WebView::create(this); |
655 owns_web_view_ = true; | 655 owns_web_view_ = true; |
656 content::ApplyWebPreferences(prefs, web_view); | 656 content::ApplyWebPreferences(prefs, web_view); |
657 web_view->setMainFrame(blink::WebFrame::create(this)); | 657 |
| 658 // We don't need to use the frame ID for this frame, so we pass 0 for it. |
| 659 web_view->setMainFrame(blink::WebFrame::create(this, 0)); |
658 frame_.Reset(web_view->mainFrame()); | 660 frame_.Reset(web_view->mainFrame()); |
659 node_to_print_.reset(); | 661 node_to_print_.reset(); |
660 | 662 |
661 // When loading is done this will call didStopLoading() and that will do the | 663 // When loading is done this will call didStopLoading() and that will do the |
662 // actual printing. | 664 // actual printing. |
663 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); | 665 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); |
664 } | 666 } |
665 | 667 |
666 void PrepareFrameAndViewForPrint::didStopLoading() { | 668 void PrepareFrameAndViewForPrint::didStopLoading() { |
667 DCHECK(!on_ready_.is_null()); | 669 DCHECK(!on_ready_.is_null()); |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 } | 2004 } |
2003 | 2005 |
2004 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 2006 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
2005 prep_frame_view_.reset(); | 2007 prep_frame_view_.reset(); |
2006 metafile_.reset(); | 2008 metafile_.reset(); |
2007 pages_to_render_.clear(); | 2009 pages_to_render_.clear(); |
2008 error_ = PREVIEW_ERROR_NONE; | 2010 error_ = PREVIEW_ERROR_NONE; |
2009 } | 2011 } |
2010 | 2012 |
2011 } // namespace printing | 2013 } // namespace printing |
OLD | NEW |