| 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 "chrome/renderer/print_web_view_helper.h" | 5 #include "chrome/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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 old_print_pages_params_.reset(); | 1206 old_print_pages_params_.reset(); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 notify_browser_of_print_failure_ = true; | 1209 notify_browser_of_print_failure_ = true; |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 bool PrintWebViewHelper::CopyAndPrint(WebKit::WebFrame* web_frame) { | 1212 bool PrintWebViewHelper::CopyAndPrint(WebKit::WebFrame* web_frame) { |
| 1213 // Create a new WebView with the same settings as the current display one. | 1213 // Create a new WebView with the same settings as the current display one. |
| 1214 // Except that we disable javascript (don't want any active content running | 1214 // Except that we disable javascript (don't want any active content running |
| 1215 // on the page). | 1215 // on the page). |
| 1216 WebPreferences prefs = render_view()->GetWebkitPreferences(); | 1216 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); |
| 1217 prefs.javascript_enabled = false; | 1217 prefs.javascript_enabled = false; |
| 1218 prefs.java_enabled = false; | 1218 prefs.java_enabled = false; |
| 1219 | 1219 |
| 1220 print_web_view_ = WebView::create(this); | 1220 print_web_view_ = WebView::create(this); |
| 1221 prefs.Apply(print_web_view_); | 1221 prefs.Apply(print_web_view_); |
| 1222 print_web_view_->initializeMainFrame(this); | 1222 print_web_view_->initializeMainFrame(this); |
| 1223 | 1223 |
| 1224 print_pages_params_->pages.clear(); // Print all pages of selection. | 1224 print_pages_params_->pages.clear(); // Print all pages of selection. |
| 1225 | 1225 |
| 1226 std::string html = web_frame->selectionAsMarkup().utf8(); | 1226 std::string html = web_frame->selectionAsMarkup().utf8(); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 DCHECK(IsRendering()); | 1890 DCHECK(IsRendering()); |
| 1891 return prep_frame_view_->GetPrintCanvasSize(); | 1891 return prep_frame_view_->GetPrintCanvasSize(); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1894 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 1895 prep_frame_view_.reset(); | 1895 prep_frame_view_.reset(); |
| 1896 metafile_.reset(); | 1896 metafile_.reset(); |
| 1897 pages_to_render_.clear(); | 1897 pages_to_render_.clear(); |
| 1898 error_ = PREVIEW_ERROR_NONE; | 1898 error_ = PREVIEW_ERROR_NONE; |
| 1899 } | 1899 } |
| OLD | NEW |