| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/gfx/jpeg_codec.h" | 8 #include "base/gfx/jpeg_codec.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 WebFrame* web_frame) { | 91 WebFrame* web_frame) { |
| 92 // Create a new WebView with the same settings as the current display one. | 92 // Create a new WebView with the same settings as the current display one. |
| 93 // Except that we disable javascript (don't want any active content running | 93 // Except that we disable javascript (don't want any active content running |
| 94 // on the page). | 94 // on the page). |
| 95 WebPreferences prefs = render_view_->webkit_preferences(); | 95 WebPreferences prefs = render_view_->webkit_preferences(); |
| 96 prefs.javascript_enabled = false; | 96 prefs.javascript_enabled = false; |
| 97 prefs.java_enabled = false; | 97 prefs.java_enabled = false; |
| 98 | 98 |
| 99 print_web_view_.reset(WebView::Create(this)); | 99 print_web_view_.reset(WebView::Create(this)); |
| 100 prefs.Apply(print_web_view_.get()); | 100 prefs.Apply(print_web_view_.get()); |
| 101 print_web_view_->InitializeMainFrame(NULL); | 101 print_web_view_->initializeMainFrame(NULL); |
| 102 | 102 |
| 103 print_pages_params_.reset(new ViewMsg_PrintPages_Params(params)); | 103 print_pages_params_.reset(new ViewMsg_PrintPages_Params(params)); |
| 104 print_pages_params_->pages.clear(); // Print all pages of selection. | 104 print_pages_params_->pages.clear(); // Print all pages of selection. |
| 105 | 105 |
| 106 std::string html = web_frame->selectionAsMarkup().utf8(); | 106 std::string html = web_frame->selectionAsMarkup().utf8(); |
| 107 std::string url_str = "data:text/html;charset=utf-8,"; | 107 std::string url_str = "data:text/html;charset=utf-8,"; |
| 108 url_str.append(html); | 108 url_str.append(html); |
| 109 GURL url(url_str); | 109 GURL url(url_str); |
| 110 | 110 |
| 111 // When loading is done this will call DidStopLoading that will do the | 111 // When loading is done this will call DidStopLoading that will do the |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 WebRect PrintWebViewHelper::rootWindowRect() { | 180 WebRect PrintWebViewHelper::rootWindowRect() { |
| 181 NOTREACHED(); | 181 NOTREACHED(); |
| 182 return WebRect(); | 182 return WebRect(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 WebScreenInfo PrintWebViewHelper::screenInfo() { | 185 WebScreenInfo PrintWebViewHelper::screenInfo() { |
| 186 NOTREACHED(); | 186 NOTREACHED(); |
| 187 return WebScreenInfo(); | 187 return WebScreenInfo(); |
| 188 } | 188 } |
| OLD | NEW |