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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 657 |
658 // We don't need to use the frame ID for this frame, so we pass 0 for it. | 658 web_view->setMainFrame(blink::WebFrame::create(this)); |
659 web_view->setMainFrame(blink::WebFrame::create(this, 0)); | |
660 frame_.Reset(web_view->mainFrame()); | 659 frame_.Reset(web_view->mainFrame()); |
661 node_to_print_.reset(); | 660 node_to_print_.reset(); |
662 | 661 |
663 // When loading is done this will call didStopLoading() and that will do the | 662 // When loading is done this will call didStopLoading() and that will do the |
664 // actual printing. | 663 // actual printing. |
665 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); | 664 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); |
666 } | 665 } |
667 | 666 |
668 void PrepareFrameAndViewForPrint::didStopLoading() { | 667 void PrepareFrameAndViewForPrint::didStopLoading() { |
669 DCHECK(!on_ready_.is_null()); | 668 DCHECK(!on_ready_.is_null()); |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 } | 2003 } |
2005 | 2004 |
2006 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 2005 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
2007 prep_frame_view_.reset(); | 2006 prep_frame_view_.reset(); |
2008 metafile_.reset(); | 2007 metafile_.reset(); |
2009 pages_to_render_.clear(); | 2008 pages_to_render_.clear(); |
2010 error_ = PREVIEW_ERROR_NONE; | 2009 error_ = PREVIEW_ERROR_NONE; |
2011 } | 2010 } |
2012 | 2011 |
2013 } // namespace printing | 2012 } // namespace printing |
OLD | NEW |