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

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

Issue 805903005: Move WeakPtrFactory members to the end in some android code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | chrome/browser/android/compositor/tab_content_manager.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276
6 6
7 #include "android_webview/renderer/print_web_view_helper.h" 7 #include "android_webview/renderer/print_web_view_helper.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, 543 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
544 const blink::WebString& name); 544 const blink::WebString& name);
545 virtual void frameDetached(blink::WebFrame* frame); 545 virtual void frameDetached(blink::WebFrame* frame);
546 546
547 private: 547 private:
548 void CallOnReady(); 548 void CallOnReady();
549 void ResizeForPrinting(); 549 void ResizeForPrinting();
550 void RestoreSize(); 550 void RestoreSize();
551 void CopySelection(const WebPreferences& preferences); 551 void CopySelection(const WebPreferences& preferences);
552 552
553 base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_;
554
555 FrameReference frame_; 553 FrameReference frame_;
556 blink::WebNode node_to_print_; 554 blink::WebNode node_to_print_;
557 bool owns_web_view_; 555 bool owns_web_view_;
558 blink::WebPrintParams web_print_params_; 556 blink::WebPrintParams web_print_params_;
559 gfx::Size prev_view_size_; 557 gfx::Size prev_view_size_;
560 gfx::Size prev_scroll_offset_; 558 gfx::Size prev_scroll_offset_;
561 int expected_pages_count_; 559 int expected_pages_count_;
562 base::Closure on_ready_; 560 base::Closure on_ready_;
563 bool should_print_backgrounds_; 561 bool should_print_backgrounds_;
564 bool should_print_selection_only_; 562 bool should_print_selection_only_;
565 bool is_printing_started_; 563 bool is_printing_started_;
566 564
565 base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_;
566
567 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); 567 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint);
568 }; 568 };
569 569
570 PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( 570 PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
571 const PrintMsg_Print_Params& params, 571 const PrintMsg_Print_Params& params,
572 blink::WebLocalFrame* frame, 572 blink::WebLocalFrame* frame,
573 const blink::WebNode& node, 573 const blink::WebNode& node,
574 bool ignore_css_margins) 574 bool ignore_css_margins)
575 : weak_ptr_factory_(this), 575 : frame_(frame),
576 frame_(frame),
577 node_to_print_(node), 576 node_to_print_(node),
578 owns_web_view_(false), 577 owns_web_view_(false),
579 expected_pages_count_(0), 578 expected_pages_count_(0),
580 should_print_backgrounds_(params.should_print_backgrounds), 579 should_print_backgrounds_(params.should_print_backgrounds),
581 should_print_selection_only_(params.selection_only), 580 should_print_selection_only_(params.selection_only),
582 is_printing_started_(false) { 581 is_printing_started_(false),
582 weak_ptr_factory_(this) {
583 PrintMsg_Print_Params print_params = params; 583 PrintMsg_Print_Params print_params = params;
584 if (!should_print_selection_only_ || 584 if (!should_print_selection_only_ ||
585 !PrintingNodeOrPdfFrame(frame, node_to_print_)) { 585 !PrintingNodeOrPdfFrame(frame, node_to_print_)) {
586 bool fit_to_page = ignore_css_margins && 586 bool fit_to_page = ignore_css_margins &&
587 print_params.print_scaling_option == 587 print_params.print_scaling_option ==
588 blink::WebPrintScalingOptionFitToPrintableArea; 588 blink::WebPrintScalingOptionFitToPrintableArea;
589 ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_); 589 ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_);
590 frame->printBegin(web_print_params_, node_to_print_); 590 frame->printBegin(web_print_params_, node_to_print_);
591 print_params = CalculatePrintParamsForCss(frame, 0, print_params, 591 print_params = CalculatePrintParamsForCss(frame, 0, print_params,
592 ignore_css_margins, fit_to_page, 592 ignore_css_margins, fit_to_page,
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 } 2008 }
2009 2009
2010 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 2010 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
2011 prep_frame_view_.reset(); 2011 prep_frame_view_.reset();
2012 metafile_.reset(); 2012 metafile_.reset();
2013 pages_to_render_.clear(); 2013 pages_to_render_.clear();
2014 error_ = PREVIEW_ERROR_NONE; 2014 error_ = PREVIEW_ERROR_NONE;
2015 } 2015 }
2016 2016
2017 } // namespace printing 2017 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/compositor/tab_content_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698