Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/system/toast/toast_overlay.h" | 5 #include "ash/common/system/toast/toast_overlay.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm_lookup.h" | 9 #include "ash/common/wm_lookup.h" |
| 10 #include "ash/common/wm_root_window_controller.h" | 10 #include "ash/common/wm_root_window_controller.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 ToastOverlay::~ToastOverlay() { | 246 ToastOverlay::~ToastOverlay() { |
| 247 overlay_widget_->Close(); | 247 overlay_widget_->Close(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void ToastOverlay::Show(bool visible) { | 250 void ToastOverlay::Show(bool visible) { |
| 251 if (overlay_widget_->GetLayer()->GetTargetVisibility() == visible) | 251 if (overlay_widget_->GetLayer()->GetTargetVisibility() == visible) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator(); | 254 ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator(); |
| 255 DCHECK(animator); | 255 DCHECK(animator); |
| 256 if (animator->is_animating()) | |
| 257 return; | |
|
oshima
2016/07/14 13:18:31
won't his also prevent showing during hiding anima
yoshiki
2016/07/15 02:38:30
It doesn't happen, since a toast overlay instance
| |
| 256 | 258 |
| 257 base::TimeDelta original_duration = animator->GetTransitionDuration(); | 259 base::TimeDelta original_duration = animator->GetTransitionDuration(); |
| 258 ui::ScopedLayerAnimationSettings animation_settings(animator); | 260 ui::ScopedLayerAnimationSettings animation_settings(animator); |
| 259 // ScopedLayerAnimationSettings ctor chanes the transition duration, so change | 261 // ScopedLayerAnimationSettings ctor chanes the transition duration, so change |
| 260 // back it to the original value (should be zero). | 262 // back it to the original value (should be zero). |
| 261 animation_settings.SetTransitionDuration(original_duration); | 263 animation_settings.SetTransitionDuration(original_duration); |
| 262 | 264 |
| 263 animation_settings.AddObserver(this); | 265 animation_settings.AddObserver(this); |
| 264 | 266 |
| 265 if (visible) { | 267 if (visible) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 289 | 291 |
| 290 views::Widget* ToastOverlay::widget_for_testing() { | 292 views::Widget* ToastOverlay::widget_for_testing() { |
| 291 return overlay_widget_.get(); | 293 return overlay_widget_.get(); |
| 292 } | 294 } |
| 293 | 295 |
| 294 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { | 296 void ToastOverlay::ClickDismissButtonForTesting(const ui::Event& event) { |
| 295 overlay_view_->button()->NotifyClick(event); | 297 overlay_view_->button()->NotifyClick(event); |
| 296 } | 298 } |
| 297 | 299 |
| 298 } // namespace ash | 300 } // namespace ash |
| OLD | NEW |