| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 if (should_animate_open) | 205 if (should_animate_open) |
| 206 StartShowing(); | 206 StartShowing(); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 void StatusBubbleViews::StatusView::Show() { | 210 void StatusBubbleViews::StatusView::Show() { |
| 211 Stop(); | 211 Stop(); |
| 212 CancelTimer(); | 212 CancelTimer(); |
| 213 SetOpacity(1.0); | 213 SetOpacity(1.0); |
| 214 popup_->Show(); | 214 popup_->ShowInactive(); |
| 215 state_ = BUBBLE_SHOWN; | 215 state_ = BUBBLE_SHOWN; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void StatusBubbleViews::StatusView::Hide() { | 218 void StatusBubbleViews::StatusView::Hide() { |
| 219 Stop(); | 219 Stop(); |
| 220 CancelTimer(); | 220 CancelTimer(); |
| 221 SetOpacity(0.0); | 221 SetOpacity(0.0); |
| 222 text_.clear(); | 222 text_.clear(); |
| 223 popup_->Hide(); | 223 popup_->Hide(); |
| 224 state_ = BUBBLE_HIDDEN; | 224 state_ = BUBBLE_HIDDEN; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 double current_opacity = GetCurrentOpacity(); | 288 double current_opacity = GetCurrentOpacity(); |
| 289 | 289 |
| 290 // Start a fade in the opposite direction. | 290 // Start a fade in the opposite direction. |
| 291 StartFade(current_opacity, 0.0, | 291 StartFade(current_opacity, 0.0, |
| 292 static_cast<int>(kHideFadeDurationMS * current_opacity)); | 292 static_cast<int>(kHideFadeDurationMS * current_opacity)); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 void StatusBubbleViews::StatusView::StartShowing() { | 296 void StatusBubbleViews::StatusView::StartShowing() { |
| 297 if (state_ == BUBBLE_HIDDEN) { | 297 if (state_ == BUBBLE_HIDDEN) { |
| 298 popup_->Show(); | 298 popup_->ShowInactive(); |
| 299 state_ = BUBBLE_SHOWING_TIMER; | 299 state_ = BUBBLE_SHOWING_TIMER; |
| 300 StartTimer(base::TimeDelta::FromMilliseconds(kShowDelay)); | 300 StartTimer(base::TimeDelta::FromMilliseconds(kShowDelay)); |
| 301 } else if (state_ == BUBBLE_HIDING_TIMER) { | 301 } else if (state_ == BUBBLE_HIDING_TIMER) { |
| 302 state_ = BUBBLE_SHOWN; | 302 state_ = BUBBLE_SHOWN; |
| 303 CancelTimer(); | 303 CancelTimer(); |
| 304 } else if (state_ == BUBBLE_HIDING_FADE) { | 304 } else if (state_ == BUBBLE_HIDING_FADE) { |
| 305 // We're partway through a fade. | 305 // We're partway through a fade. |
| 306 state_ = BUBBLE_SHOWING_FADE; | 306 state_ = BUBBLE_SHOWING_FADE; |
| 307 | 307 |
| 308 // Figure out where we are in the current fade. | 308 // Figure out where we are in the current fade. |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 void StatusBubbleViews::SetBubbleWidth(int width) { | 846 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 847 size_.set_width(width); | 847 size_.set_width(width); |
| 848 SetBounds(original_position_.x(), original_position_.y(), | 848 SetBounds(original_position_.x(), original_position_.y(), |
| 849 size_.width(), size_.height()); | 849 size_.width(), size_.height()); |
| 850 } | 850 } |
| 851 | 851 |
| 852 void StatusBubbleViews::CancelExpandTimer() { | 852 void StatusBubbleViews::CancelExpandTimer() { |
| 853 if (expand_timer_factory_.HasWeakPtrs()) | 853 if (expand_timer_factory_.HasWeakPtrs()) |
| 854 expand_timer_factory_.InvalidateWeakPtrs(); | 854 expand_timer_factory_.InvalidateWeakPtrs(); |
| 855 } | 855 } |
| OLD | NEW |