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

Side by Side Diff: ash/common/system/toast/toast_overlay.cc

Issue 2150603003: Prevent hiding a toast during animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months 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 | « no previous file | 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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698