Index: chrome/renderer/printing/print_web_view_helper.cc |
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc |
index 1da901d7b8af953062ff14b68286808ca545fcb4..1644305859eeacacb437859f109f703e21c394b1 100644 |
--- a/chrome/renderer/printing/print_web_view_helper.cc |
+++ b/chrome/renderer/printing/print_web_view_helper.cc |
@@ -20,10 +20,10 @@ |
#include "chrome/common/print_messages.h" |
#include "chrome/common/render_messages.h" |
#include "chrome/renderer/prerender/prerender_helper.h" |
+#include "content/public/common/web_preferences.h" |
#include "content/public/renderer/render_frame.h" |
#include "content/public/renderer/render_thread.h" |
#include "content/public/renderer/render_view.h" |
-#include "content/public/renderer/web_preferences.h" |
#include "grit/browser_resources.h" |
#include "net/base/escape.h" |
#include "printing/metafile.h" |
@@ -46,7 +46,8 @@ |
#include "third_party/WebKit/public/web/WebView.h" |
#include "third_party/WebKit/public/web/WebViewClient.h" |
#include "ui/base/resource/resource_bundle.h" |
-#include "webkit/common/webpreferences.h" |
+ |
+using content::WebPreferences; |
namespace printing { |
@@ -532,6 +533,7 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient, |
public blink::WebFrameClient { |
public: |
PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params, |
+ content::RenderView* render_view, |
blink::WebLocalFrame* frame, |
const blink::WebNode& node, |
bool ignore_css_margins); |
@@ -588,6 +590,7 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient, |
base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_; |
+ content::RenderView* render_view_; |
FrameReference frame_; |
blink::WebNode node_to_print_; |
bool owns_web_view_; |
@@ -605,10 +608,12 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient, |
PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( |
const PrintMsg_Print_Params& params, |
+ content::RenderView* render_view, |
blink::WebLocalFrame* frame, |
const blink::WebNode& node, |
bool ignore_css_margins) |
: weak_ptr_factory_(this), |
+ render_view_(render_view), |
frame_(frame), |
node_to_print_(node), |
owns_web_view_(false), |
@@ -696,7 +701,7 @@ void PrepareFrameAndViewForPrint::CopySelection( |
blink::WebView* web_view = blink::WebView::create(this); |
owns_web_view_ = true; |
- content::ApplyWebPreferences(prefs, web_view); |
+ render_view_->ApplyWebPreferences(prefs); |
web_view->setMainFrame(blink::WebLocalFrame::create(this)); |
frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); |
node_to_print_.reset(); |
@@ -1066,6 +1071,7 @@ void PrintWebViewHelper::PrepareFrameForPreviewDocument() { |
const PrintMsg_Print_Params& print_params = print_pages_params_->params; |
prep_frame_view_.reset( |
new PrepareFrameAndViewForPrint(print_params, |
+ render_view(), |
print_preview_context_.source_frame(), |
print_preview_context_.source_node(), |
ignore_css_margins_)); |
@@ -1456,7 +1462,8 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, |
} |
const PrintMsg_Print_Params& params = print_pages_params_->params; |
- PrepareFrameAndViewForPrint prepare(params, frame, node, ignore_css_margins_); |
+ PrepareFrameAndViewForPrint prepare( |
+ params, render_view(), frame, node, ignore_css_margins_); |
prepare.StartPrinting(); |
Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), |
@@ -1596,9 +1603,8 @@ bool PrintWebViewHelper::RenderPagesForPrint(blink::WebLocalFrame* frame, |
return false; |
const PrintMsg_PrintPages_Params& params = *print_pages_params_; |
const PrintMsg_Print_Params& print_params = params.params; |
- prep_frame_view_.reset( |
- new PrepareFrameAndViewForPrint(print_params, frame, node, |
- ignore_css_margins_)); |
+ prep_frame_view_.reset(new PrepareFrameAndViewForPrint( |
+ print_params, render_view(), frame, node, ignore_css_margins_)); |
DCHECK(!print_pages_params_->params.selection_only || |
print_pages_params_->pages.empty()); |
prep_frame_view_->CopySelectionIfNeeded( |