OLD | NEW |
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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 ResizeForPrinting(); | 705 ResizeForPrinting(); |
706 std::string url_str = "data:text/html;charset=utf-8,"; | 706 std::string url_str = "data:text/html;charset=utf-8,"; |
707 url_str.append( | 707 url_str.append( |
708 net::EscapeQueryParamValue(frame()->selectionAsMarkup().utf8(), false)); | 708 net::EscapeQueryParamValue(frame()->selectionAsMarkup().utf8(), false)); |
709 RestoreSize(); | 709 RestoreSize(); |
710 // Create a new WebView with the same settings as the current display one. | 710 // Create a new WebView with the same settings as the current display one. |
711 // Except that we disable javascript (don't want any active content running | 711 // Except that we disable javascript (don't want any active content running |
712 // on the page). | 712 // on the page). |
713 WebPreferences prefs = preferences; | 713 WebPreferences prefs = preferences; |
714 prefs.javascript_enabled = false; | 714 prefs.javascript_enabled = false; |
715 prefs.java_enabled = false; | |
716 | 715 |
717 blink::WebView* web_view = blink::WebView::create(this); | 716 blink::WebView* web_view = blink::WebView::create(this); |
718 owns_web_view_ = true; | 717 owns_web_view_ = true; |
719 content::RenderView::ApplyWebPreferences(prefs, web_view); | 718 content::RenderView::ApplyWebPreferences(prefs, web_view); |
720 web_view->setMainFrame( | 719 web_view->setMainFrame( |
721 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this)); | 720 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this)); |
722 frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); | 721 frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); |
723 node_to_print_.reset(); | 722 node_to_print_.reset(); |
724 | 723 |
725 // When loading is done this will call didStopLoading() and that will do the | 724 // When loading is done this will call didStopLoading() and that will do the |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 blink::WebConsoleMessage::LevelWarning, message)); | 2096 blink::WebConsoleMessage::LevelWarning, message)); |
2098 return false; | 2097 return false; |
2099 } | 2098 } |
2100 | 2099 |
2101 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2100 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2102 // Reset counter on successful print. | 2101 // Reset counter on successful print. |
2103 count_ = 0; | 2102 count_ = 0; |
2104 } | 2103 } |
2105 | 2104 |
2106 } // namespace printing | 2105 } // namespace printing |
OLD | NEW |