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

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

Issue 795943002: Fix WeakPtrFactory member ordering in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding more changes Created 6 years 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 | « chrome/browser/ui/browser.cc ('k') | no next file » | 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) 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/printing/print_web_view_helper.h" 5 #include "chrome/renderer/printing/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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, 600 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
601 const blink::WebString& name); 601 const blink::WebString& name);
602 virtual void frameDetached(blink::WebFrame* frame); 602 virtual void frameDetached(blink::WebFrame* frame);
603 603
604 private: 604 private:
605 void CallOnReady(); 605 void CallOnReady();
606 void ResizeForPrinting(); 606 void ResizeForPrinting();
607 void RestoreSize(); 607 void RestoreSize();
608 void CopySelection(const WebPreferences& preferences); 608 void CopySelection(const WebPreferences& preferences);
609 609
610 base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_;
611
612 FrameReference frame_; 610 FrameReference frame_;
613 blink::WebNode node_to_print_; 611 blink::WebNode node_to_print_;
614 bool owns_web_view_; 612 bool owns_web_view_;
615 blink::WebPrintParams web_print_params_; 613 blink::WebPrintParams web_print_params_;
616 gfx::Size prev_view_size_; 614 gfx::Size prev_view_size_;
617 gfx::Size prev_scroll_offset_; 615 gfx::Size prev_scroll_offset_;
618 int expected_pages_count_; 616 int expected_pages_count_;
619 base::Closure on_ready_; 617 base::Closure on_ready_;
620 bool should_print_backgrounds_; 618 bool should_print_backgrounds_;
621 bool should_print_selection_only_; 619 bool should_print_selection_only_;
622 bool is_printing_started_; 620 bool is_printing_started_;
623 621
622 base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_;
623
624 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); 624 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint);
625 }; 625 };
626 626
627 PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( 627 PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
628 const PrintMsg_Print_Params& params, 628 const PrintMsg_Print_Params& params,
629 blink::WebLocalFrame* frame, 629 blink::WebLocalFrame* frame,
630 const blink::WebNode& node, 630 const blink::WebNode& node,
631 bool ignore_css_margins) 631 bool ignore_css_margins)
632 : weak_ptr_factory_(this), 632 : frame_(frame),
633 frame_(frame),
634 node_to_print_(node), 633 node_to_print_(node),
635 owns_web_view_(false), 634 owns_web_view_(false),
636 expected_pages_count_(0), 635 expected_pages_count_(0),
637 should_print_backgrounds_(params.should_print_backgrounds), 636 should_print_backgrounds_(params.should_print_backgrounds),
638 should_print_selection_only_(params.selection_only), 637 should_print_selection_only_(params.selection_only),
639 is_printing_started_(false) { 638 is_printing_started_(false),
639 weak_ptr_factory_(this) {
640 PrintMsg_Print_Params print_params = params; 640 PrintMsg_Print_Params print_params = params;
641 if (!should_print_selection_only_ || 641 if (!should_print_selection_only_ ||
642 !PrintingNodeOrPdfFrame(frame, node_to_print_)) { 642 !PrintingNodeOrPdfFrame(frame, node_to_print_)) {
643 bool fit_to_page = ignore_css_margins && 643 bool fit_to_page = ignore_css_margins &&
644 print_params.print_scaling_option == 644 print_params.print_scaling_option ==
645 blink::WebPrintScalingOptionFitToPrintableArea; 645 blink::WebPrintScalingOptionFitToPrintableArea;
646 ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_); 646 ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_);
647 frame->printBegin(web_print_params_, node_to_print_); 647 frame->printBegin(web_print_params_, node_to_print_);
648 print_params = CalculatePrintParamsForCss(frame, 0, print_params, 648 print_params = CalculatePrintParamsForCss(frame, 0, print_params,
649 ignore_css_margins, fit_to_page, 649 ignore_css_margins, fit_to_page,
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 blink::WebConsoleMessage::LevelWarning, message)); 2055 blink::WebConsoleMessage::LevelWarning, message));
2056 return false; 2056 return false;
2057 } 2057 }
2058 2058
2059 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2059 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2060 // Reset counter on successful print. 2060 // Reset counter on successful print.
2061 count_ = 0; 2061 count_ = 0;
2062 } 2062 }
2063 2063
2064 } // namespace printing 2064 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698