| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 RestoreSize(); | 711 RestoreSize(); |
| 712 // Create a new WebView with the same settings as the current display one. | 712 // Create a new WebView with the same settings as the current display one. |
| 713 // Except that we disable javascript (don't want any active content running | 713 // Except that we disable javascript (don't want any active content running |
| 714 // on the page). | 714 // on the page). |
| 715 WebPreferences prefs = preferences; | 715 WebPreferences prefs = preferences; |
| 716 prefs.javascript_enabled = false; | 716 prefs.javascript_enabled = false; |
| 717 prefs.java_enabled = false; | 717 prefs.java_enabled = false; |
| 718 | 718 |
| 719 blink::WebView* web_view = blink::WebView::create(this); | 719 blink::WebView* web_view = blink::WebView::create(this); |
| 720 owns_web_view_ = true; | 720 owns_web_view_ = true; |
| 721 content::RenderView::ApplyWebPreferences(prefs, web_view); | 721 content::RenderView::ApplyWebPreferencesInternal(prefs, web_view, NULL); |
| 722 web_view->setMainFrame( | 722 web_view->setMainFrame( |
| 723 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this)); | 723 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this)); |
| 724 frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); | 724 frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); |
| 725 node_to_print_.reset(); | 725 node_to_print_.reset(); |
| 726 | 726 |
| 727 // When loading is done this will call didStopLoading() and that will do the | 727 // When loading is done this will call didStopLoading() and that will do the |
| 728 // actual printing. | 728 // actual printing. |
| 729 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); | 729 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); |
| 730 } | 730 } |
| 731 | 731 |
| (...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 blink::WebConsoleMessage::LevelWarning, message)); | 2084 blink::WebConsoleMessage::LevelWarning, message)); |
| 2085 return false; | 2085 return false; |
| 2086 } | 2086 } |
| 2087 | 2087 |
| 2088 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2088 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
| 2089 // Reset counter on successful print. | 2089 // Reset counter on successful print. |
| 2090 count_ = 0; | 2090 count_ = 0; |
| 2091 } | 2091 } |
| 2092 | 2092 |
| 2093 } // namespace printing | 2093 } // namespace printing |
| OLD | NEW |