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

Side by Side Diff: chrome/browser/ui/views/status_bubble_views.cc

Issue 780713002: Fix remaining WeakPtrFactory ordering problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove flag change, merge 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
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/browser/ui/views/status_bubble_views.h" 5 #include "chrome/browser/ui/views/status_bubble_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void StartFade(double start, double end, int duration); 166 void StartFade(double start, double end, int duration);
167 void StartHiding(); 167 void StartHiding();
168 void StartShowing(); 168 void StartShowing();
169 169
170 // views::View: 170 // views::View:
171 void OnPaint(gfx::Canvas* canvas) override; 171 void OnPaint(gfx::Canvas* canvas) override;
172 172
173 BubbleState state_; 173 BubbleState state_;
174 BubbleStyle style_; 174 BubbleStyle style_;
175 175
176 base::WeakPtrFactory<StatusBubbleViews::StatusView> timer_factory_;
177
178 scoped_ptr<StatusViewAnimation> animation_; 176 scoped_ptr<StatusViewAnimation> animation_;
179 177
180 // Handle to the widget that contains us. 178 // Handle to the widget that contains us.
181 views::Widget* popup_; 179 views::Widget* popup_;
182 180
183 // The currently-displayed text. 181 // The currently-displayed text.
184 base::string16 text_; 182 base::string16 text_;
185 183
186 // Holds the theme provider of the frame that created us. 184 // Holds the theme provider of the frame that created us.
187 ui::ThemeProvider* theme_service_; 185 ui::ThemeProvider* theme_service_;
188 186
187 base::WeakPtrFactory<StatusBubbleViews::StatusView> timer_factory_;
188
189 DISALLOW_COPY_AND_ASSIGN(StatusView); 189 DISALLOW_COPY_AND_ASSIGN(StatusView);
190 }; 190 };
191 191
192 StatusBubbleViews::StatusView::StatusView(views::Widget* popup, 192 StatusBubbleViews::StatusView::StatusView(views::Widget* popup,
193 ui::ThemeProvider* theme_provider) 193 ui::ThemeProvider* theme_provider)
194 : state_(BUBBLE_HIDDEN), 194 : state_(BUBBLE_HIDDEN),
195 style_(STYLE_STANDARD), 195 style_(STYLE_STANDARD),
196 timer_factory_(this),
197 animation_(new StatusViewAnimation(this, 0, 0)), 196 animation_(new StatusViewAnimation(this, 0, 0)),
198 popup_(popup), 197 popup_(popup),
199 theme_service_(theme_provider) { 198 theme_service_(theme_provider),
199 timer_factory_(this) {
200 } 200 }
201 201
202 StatusBubbleViews::StatusView::~StatusView() { 202 StatusBubbleViews::StatusView::~StatusView() {
203 animation_->Stop(); 203 animation_->Stop();
204 CancelTimer(); 204 CancelTimer();
205 } 205 }
206 206
207 void StatusBubbleViews::StatusView::SetText(const base::string16& text, 207 void StatusBubbleViews::StatusView::SetText(const base::string16& text,
208 bool should_animate_open) { 208 bool should_animate_open) {
209 if (text.empty()) { 209 if (text.empty()) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 void StatusBubbleViews::SetBubbleWidth(int width) { 867 void StatusBubbleViews::SetBubbleWidth(int width) {
868 size_.set_width(width); 868 size_.set_width(width);
869 SetBounds(original_position_.x(), original_position_.y(), 869 SetBounds(original_position_.x(), original_position_.y(),
870 size_.width(), size_.height()); 870 size_.width(), size_.height());
871 } 871 }
872 872
873 void StatusBubbleViews::CancelExpandTimer() { 873 void StatusBubbleViews::CancelExpandTimer() {
874 if (expand_timer_factory_.HasWeakPtrs()) 874 if (expand_timer_factory_.HasWeakPtrs())
875 expand_timer_factory_.InvalidateWeakPtrs(); 875 expand_timer_factory_.InvalidateWeakPtrs();
876 } 876 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698