Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/renderer/print_web_view_helper.cc

Issue 2864020: DevTools: Migrate to new WebView initialization (pass devtools client directly). (Closed)
Patch Set: deps roll Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 8 #include "base/logging.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/renderer/render_view.h" 10 #include "chrome/renderer/render_view.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 bool PrintWebViewHelper::CopyAndPrint(const ViewMsg_PrintPages_Params& params, 240 bool PrintWebViewHelper::CopyAndPrint(const ViewMsg_PrintPages_Params& params,
241 WebFrame* web_frame) { 241 WebFrame* web_frame) {
242 // Create a new WebView with the same settings as the current display one. 242 // Create a new WebView with the same settings as the current display one.
243 // Except that we disable javascript (don't want any active content running 243 // Except that we disable javascript (don't want any active content running
244 // on the page). 244 // on the page).
245 WebPreferences prefs = render_view_->webkit_preferences(); 245 WebPreferences prefs = render_view_->webkit_preferences();
246 prefs.javascript_enabled = false; 246 prefs.javascript_enabled = false;
247 prefs.java_enabled = false; 247 prefs.java_enabled = false;
248 248
249 print_web_view_ = WebView::create(this); 249 print_web_view_ = WebView::create(this, 0);
250 prefs.Apply(print_web_view_); 250 prefs.Apply(print_web_view_);
251 print_web_view_->initializeMainFrame(this); 251 print_web_view_->initializeMainFrame(this);
252 252
253 print_pages_params_.reset(new ViewMsg_PrintPages_Params(params)); 253 print_pages_params_.reset(new ViewMsg_PrintPages_Params(params));
254 print_pages_params_->pages.clear(); // Print all pages of selection. 254 print_pages_params_->pages.clear(); // Print all pages of selection.
255 255
256 std::string html = web_frame->selectionAsMarkup().utf8(); 256 std::string html = web_frame->selectionAsMarkup().utf8();
257 std::string url_str = "data:text/html;charset=utf-8,"; 257 std::string url_str = "data:text/html;charset=utf-8,";
258 url_str.append(html); 258 url_str.append(html);
259 GURL url(url_str); 259 GURL url(url_str);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 int32 PrintWebViewHelper::routing_id() { 340 int32 PrintWebViewHelper::routing_id() {
341 return render_view_->routing_id(); 341 return render_view_->routing_id();
342 } 342 }
343 343
344 void PrintWebViewHelper::didStopLoading() { 344 void PrintWebViewHelper::didStopLoading() {
345 DCHECK(print_pages_params_.get() != NULL); 345 DCHECK(print_pages_params_.get() != NULL);
346 PrintPages(*print_pages_params_.get(), print_web_view_->mainFrame()); 346 PrintPages(*print_pages_params_.get(), print_web_view_->mainFrame());
347 } 347 }
OLDNEW
« no previous file with comments | « DEPS ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698