| 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/tray_background_view.h" | 5 #include "ash/system/tray/tray_background_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
| 11 #include "ash/shelf/wm_shelf.h" | 11 #include "ash/shelf/wm_shelf.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/system/status_area_widget_delegate.h" | 13 #include "ash/system/status_area_widget_delegate.h" |
| 14 #include "ash/system/tray/system_tray_notifier.h" | 14 #include "ash/system/tray/system_tray_notifier.h" |
| 15 #include "ash/system/tray/tray_constants.h" | 15 #include "ash/system/tray/tray_constants.h" |
| 16 #include "ash/system/tray/tray_container.h" | 16 #include "ash/system/tray/tray_container.h" |
| 17 #include "ash/system/tray/tray_event_filter.h" | 17 #include "ash/system/tray/tray_event_filter.h" |
| 18 #include "ash/wm_window.h" | |
| 19 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 20 #include "ui/accessibility/ax_node_data.h" | 19 #include "ui/accessibility/ax_node_data.h" |
| 21 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/layer_animation_element.h" | 21 #include "ui/compositor/layer_animation_element.h" |
| 23 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 24 #include "ui/gfx/animation/tween.h" | 23 #include "ui/gfx/animation/tween.h" |
| 25 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 26 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 27 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
| 28 #include "ui/gfx/transform.h" | 27 #include "ui/gfx/transform.h" |
| 29 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 30 #include "ui/views/animation/ink_drop_highlight.h" | 29 #include "ui/views/animation/ink_drop_highlight.h" |
| 31 #include "ui/views/animation/ink_drop_mask.h" | 30 #include "ui/views/animation/ink_drop_mask.h" |
| 32 #include "ui/views/background.h" | 31 #include "ui/views/background.h" |
| 33 #include "ui/views/layout/fill_layout.h" | 32 #include "ui/views/layout/fill_layout.h" |
| 33 #include "ui/wm/core/window_animations.h" |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 const int kAnimationDurationForPopupMs = 200; | 37 const int kAnimationDurationForPopupMs = 200; |
| 38 | 38 |
| 39 // Duration of opacity animation for visibility changes. | 39 // Duration of opacity animation for visibility changes. |
| 40 const int kAnimationDurationForVisibilityMs = 250; | 40 const int kAnimationDurationForVisibilityMs = 250; |
| 41 | 41 |
| 42 // When becoming visible delay the animation so that StatusAreaWidgetDelegate | 42 // When becoming visible delay the animation so that StatusAreaWidgetDelegate |
| 43 // can animate sibling views out of the position to be occuped by the | 43 // can animate sibling views out of the position to be occuped by the |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 StopObservingImplicitAnimations(); | 164 StopObservingImplicitAnimations(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void TrayBackgroundView::Initialize() { | 167 void TrayBackgroundView::Initialize() { |
| 168 GetWidget()->AddObserver(widget_observer_.get()); | 168 GetWidget()->AddObserver(widget_observer_.get()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // static | 171 // static |
| 172 void TrayBackgroundView::InitializeBubbleAnimations( | 172 void TrayBackgroundView::InitializeBubbleAnimations( |
| 173 views::Widget* bubble_widget) { | 173 views::Widget* bubble_widget) { |
| 174 WmWindow* window = WmWindow::Get(bubble_widget->GetNativeWindow()); | 174 aura::Window* window = bubble_widget->GetNativeWindow(); |
| 175 window->SetVisibilityAnimationType( | 175 ::wm::SetWindowVisibilityAnimationType( |
| 176 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 176 window, ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
| 177 window->SetVisibilityAnimationTransition(::wm::ANIMATE_HIDE); | 177 ::wm::SetWindowVisibilityAnimationTransition(window, ::wm::ANIMATE_HIDE); |
| 178 window->SetVisibilityAnimationDuration( | 178 ::wm::SetWindowVisibilityAnimationDuration( |
| 179 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs)); | 179 window, base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void TrayBackgroundView::SetVisible(bool visible) { | 182 void TrayBackgroundView::SetVisible(bool visible) { |
| 183 if (visible == layer()->GetTargetVisibility()) | 183 if (visible == layer()->GetTargetVisibility()) |
| 184 return; | 184 return; |
| 185 | 185 |
| 186 if (visible) { | 186 if (visible) { |
| 187 // The alignment of the shelf can change while the TrayBackgroundView is | 187 // The alignment of the shelf can change while the TrayBackgroundView is |
| 188 // hidden. Reset the offscreen transform so that the animation to becoming | 188 // hidden. Reset the offscreen transform so that the animation to becoming |
| 189 // visible reflects the current layout. | 189 // visible reflects the current layout. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 431 } |
| 432 | 432 |
| 433 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { | 433 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { |
| 434 gfx::Insets insets = GetBackgroundInsets(); | 434 gfx::Insets insets = GetBackgroundInsets(); |
| 435 gfx::Rect bounds = GetLocalBounds(); | 435 gfx::Rect bounds = GetLocalBounds(); |
| 436 bounds.Inset(insets); | 436 bounds.Inset(insets); |
| 437 return bounds; | 437 return bounds; |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace ash | 440 } // namespace ash |
| OLD | NEW |