| OLD | NEW |
| 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 "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 void StartFade(double start, double end, int duration); | 164 void StartFade(double start, double end, int duration); |
| 165 void StartHiding(); | 165 void StartHiding(); |
| 166 void StartShowing(); | 166 void StartShowing(); |
| 167 | 167 |
| 168 // views::View: | 168 // views::View: |
| 169 void OnPaint(gfx::Canvas* canvas) override; | 169 void OnPaint(gfx::Canvas* canvas) override; |
| 170 | 170 |
| 171 BubbleState state_; | 171 BubbleState state_; |
| 172 BubbleStyle style_; | 172 BubbleStyle style_; |
| 173 | 173 |
| 174 base::WeakPtrFactory<StatusBubbleViews::StatusView> timer_factory_; | |
| 175 | |
| 176 scoped_ptr<StatusViewAnimation> animation_; | 174 scoped_ptr<StatusViewAnimation> animation_; |
| 177 | 175 |
| 178 // Handle to the widget that contains us. | 176 // Handle to the widget that contains us. |
| 179 views::Widget* popup_; | 177 views::Widget* popup_; |
| 180 | 178 |
| 181 // The currently-displayed text. | 179 // The currently-displayed text. |
| 182 base::string16 text_; | 180 base::string16 text_; |
| 183 | 181 |
| 184 // Holds the theme provider of the frame that created us. | 182 // Holds the theme provider of the frame that created us. |
| 185 ui::ThemeProvider* theme_service_; | 183 ui::ThemeProvider* theme_service_; |
| 186 | 184 |
| 185 base::WeakPtrFactory<StatusBubbleViews::StatusView> timer_factory_; |
| 186 |
| 187 DISALLOW_COPY_AND_ASSIGN(StatusView); | 187 DISALLOW_COPY_AND_ASSIGN(StatusView); |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 StatusBubbleViews::StatusView::StatusView(views::Widget* popup, | 190 StatusBubbleViews::StatusView::StatusView(views::Widget* popup, |
| 191 ui::ThemeProvider* theme_provider) | 191 ui::ThemeProvider* theme_provider) |
| 192 : state_(BUBBLE_HIDDEN), | 192 : state_(BUBBLE_HIDDEN), |
| 193 style_(STYLE_STANDARD), | 193 style_(STYLE_STANDARD), |
| 194 timer_factory_(this), | |
| 195 animation_(new StatusViewAnimation(this, 0, 0)), | 194 animation_(new StatusViewAnimation(this, 0, 0)), |
| 196 popup_(popup), | 195 popup_(popup), |
| 197 theme_service_(theme_provider) { | 196 theme_service_(theme_provider), |
| 197 timer_factory_(this) { |
| 198 } | 198 } |
| 199 | 199 |
| 200 StatusBubbleViews::StatusView::~StatusView() { | 200 StatusBubbleViews::StatusView::~StatusView() { |
| 201 animation_->Stop(); | 201 animation_->Stop(); |
| 202 CancelTimer(); | 202 CancelTimer(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void StatusBubbleViews::StatusView::SetText(const base::string16& text, | 205 void StatusBubbleViews::StatusView::SetText(const base::string16& text, |
| 206 bool should_animate_open) { | 206 bool should_animate_open) { |
| 207 if (text.empty()) { | 207 if (text.empty()) { |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 void StatusBubbleViews::SetBubbleWidth(int width) { | 864 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 865 size_.set_width(width); | 865 size_.set_width(width); |
| 866 SetBounds(original_position_.x(), original_position_.y(), | 866 SetBounds(original_position_.x(), original_position_.y(), |
| 867 size_.width(), size_.height()); | 867 size_.width(), size_.height()); |
| 868 } | 868 } |
| 869 | 869 |
| 870 void StatusBubbleViews::CancelExpandTimer() { | 870 void StatusBubbleViews::CancelExpandTimer() { |
| 871 if (expand_timer_factory_.HasWeakPtrs()) | 871 if (expand_timer_factory_.HasWeakPtrs()) |
| 872 expand_timer_factory_.InvalidateWeakPtrs(); | 872 expand_timer_factory_.InvalidateWeakPtrs(); |
| 873 } | 873 } |
| OLD | NEW |