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 "ash/system/tray/system_tray_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 base::TimeDelta::FromMilliseconds(kSwipeDelayMS); | 160 base::TimeDelta::FromMilliseconds(kSwipeDelayMS); |
161 scoped_layer.reset(bubble_view_->RecreateLayer()); | 161 scoped_layer.reset(bubble_view_->RecreateLayer()); |
162 // Keep the reference to layer as we need it after releasing it. | 162 // Keep the reference to layer as we need it after releasing it. |
163 ui::Layer* layer = scoped_layer.get(); | 163 ui::Layer* layer = scoped_layer.get(); |
164 DCHECK(layer); | 164 DCHECK(layer); |
165 layer->SuppressPaint(); | 165 layer->SuppressPaint(); |
166 | 166 |
167 // When transitioning from detailed view to default view, animate the | 167 // When transitioning from detailed view to default view, animate the |
168 // existing view (slide out towards the right). | 168 // existing view (slide out towards the right). |
169 if (bubble_type == BUBBLE_TYPE_DEFAULT) { | 169 if (bubble_type == BUBBLE_TYPE_DEFAULT) { |
170 // Make sure the old view is visibile over the new view during the | |
171 // animation. | |
172 layer->parent()->StackAbove(layer, bubble_view_->layer()); | |
173 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); | 170 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); |
174 settings.AddObserver( | 171 settings.AddObserver( |
175 new AnimationObserverDeleteLayer(scoped_layer.release())); | 172 new AnimationObserverDeleteLayer(scoped_layer.release())); |
176 settings.SetTransitionDuration(swipe_duration); | 173 settings.SetTransitionDuration(swipe_duration); |
177 settings.SetTweenType(ui::Tween::EASE_OUT); | 174 settings.SetTweenType(ui::Tween::EASE_OUT); |
178 gfx::Transform transform; | 175 gfx::Transform transform; |
179 transform.Translate(layer->bounds().width(), 0.0); | 176 transform.Translate(layer->bounds().width(), 0.0); |
180 layer->SetTransform(transform); | 177 layer->SetTransform(transform); |
181 } | 178 } |
182 | 179 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // Make sure that the bubble is large enough for the default view. | 220 // Make sure that the bubble is large enough for the default view. |
224 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) { | 221 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) { |
225 bubble_view_->SetMaxHeight(0); // Clear max height limit. | 222 bubble_view_->SetMaxHeight(0); // Clear max height limit. |
226 } | 223 } |
227 | 224 |
228 if (scoped_layer) { | 225 if (scoped_layer) { |
229 // When transitioning from default view to detailed view, animate the new | 226 // When transitioning from default view to detailed view, animate the new |
230 // view (slide in from the right). | 227 // view (slide in from the right). |
231 if (bubble_type == BUBBLE_TYPE_DETAILED) { | 228 if (bubble_type == BUBBLE_TYPE_DETAILED) { |
232 ui::Layer* new_layer = bubble_view_->layer(); | 229 ui::Layer* new_layer = bubble_view_->layer(); |
| 230 |
| 231 // Make sure the new layer is stacked above the old layer during the |
| 232 // animation. |
| 233 new_layer->parent()->StackAbove(new_layer, scoped_layer.get()); |
| 234 |
233 gfx::Rect bounds = new_layer->bounds(); | 235 gfx::Rect bounds = new_layer->bounds(); |
234 gfx::Transform transform; | 236 gfx::Transform transform; |
235 transform.Translate(bounds.width(), 0.0); | 237 transform.Translate(bounds.width(), 0.0); |
236 new_layer->SetTransform(transform); | 238 new_layer->SetTransform(transform); |
237 { | 239 { |
238 ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator()); | 240 ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator()); |
239 settings.AddObserver( | 241 settings.AddObserver( |
240 new AnimationObserverDeleteLayer(scoped_layer.release())); | 242 new AnimationObserverDeleteLayer(scoped_layer.release())); |
241 settings.SetTransitionDuration( | 243 settings.SetTransitionDuration( |
242 base::TimeDelta::FromMilliseconds(kSwipeDelayMS)); | 244 base::TimeDelta::FromMilliseconds(kSwipeDelayMS)); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // For default view, draw bottom border for each item, except the last | 364 // For default view, draw bottom border for each item, except the last |
363 // 2 items, which are the bottom header row and the one just above it. | 365 // 2 items, which are the bottom header row and the one just above it. |
364 bubble_view_->AddChildView(new TrayPopupItemContainer( | 366 bubble_view_->AddChildView(new TrayPopupItemContainer( |
365 item_views[i], is_default_bubble, | 367 item_views[i], is_default_bubble, |
366 is_default_bubble && (i < item_views.size() - 2))); | 368 is_default_bubble && (i < item_views.size() - 2))); |
367 } | 369 } |
368 } | 370 } |
369 | 371 |
370 } // namespace internal | 372 } // namespace internal |
371 } // namespace ash | 373 } // namespace ash |
OLD | NEW |