| 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 "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (GetWidget()) | 258 if (GetWidget()) |
| 259 GetWidget()->RemoveObserver(widget_observer_.get()); | 259 GetWidget()->RemoveObserver(widget_observer_.get()); |
| 260 StopObservingImplicitAnimations(); | 260 StopObservingImplicitAnimations(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void TrayBackgroundView::Initialize() { | 263 void TrayBackgroundView::Initialize() { |
| 264 GetWidget()->AddObserver(widget_observer_.get()); | 264 GetWidget()->AddObserver(widget_observer_.get()); |
| 265 SetTrayBorder(); | 265 SetTrayBorder(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 // static |
| 269 void TrayBackgroundView::InitializeBubbleAnimations( |
| 270 views::Widget* bubble_widget) { |
| 271 aura::Window* window = bubble_widget->GetNativeWindow(); |
| 272 ::wm::SetWindowVisibilityAnimationType( |
| 273 window, ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
| 274 ::wm::SetWindowVisibilityAnimationTransition(window, ::wm::ANIMATE_HIDE); |
| 275 ::wm::SetWindowVisibilityAnimationDuration( |
| 276 window, base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs)); |
| 277 } |
| 278 |
| 268 void TrayBackgroundView::SetVisible(bool visible) { | 279 void TrayBackgroundView::SetVisible(bool visible) { |
| 269 if (visible == layer()->GetTargetVisibility()) | 280 if (visible == layer()->GetTargetVisibility()) |
| 270 return; | 281 return; |
| 271 | 282 |
| 272 if (visible) { | 283 if (visible) { |
| 273 // The alignment of the shelf can change while the TrayBackgroundView is | 284 // The alignment of the shelf can change while the TrayBackgroundView is |
| 274 // hidden. Reset the offscreen transform so that the animation to becoming | 285 // hidden. Reset the offscreen transform so that the animation to becoming |
| 275 // visible reflects the current layout. | 286 // visible reflects the current layout. |
| 276 HideTransformation(); | 287 HideTransformation(); |
| 277 // SetVisible(false) is defered until the animation for hiding is done. | 288 // SetVisible(false) is defered until the animation for hiding is done. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 463 |
| 453 void TrayBackgroundView::HideTransformation() { | 464 void TrayBackgroundView::HideTransformation() { |
| 454 gfx::Transform transform; | 465 gfx::Transform transform; |
| 455 if (wm::IsHorizontalAlignment(shelf_alignment_)) | 466 if (wm::IsHorizontalAlignment(shelf_alignment_)) |
| 456 transform.Translate(width(), 0.0f); | 467 transform.Translate(width(), 0.0f); |
| 457 else | 468 else |
| 458 transform.Translate(0.0f, height()); | 469 transform.Translate(0.0f, height()); |
| 459 layer()->SetTransform(transform); | 470 layer()->SetTransform(transform); |
| 460 } | 471 } |
| 461 | 472 |
| 462 void TrayBackgroundView::InitializeBubbleAnimations( | |
| 463 views::Widget* bubble_widget) { | |
| 464 ::wm::SetWindowVisibilityAnimationType( | |
| 465 bubble_widget->GetNativeWindow(), | |
| 466 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | |
| 467 ::wm::SetWindowVisibilityAnimationTransition(bubble_widget->GetNativeWindow(), | |
| 468 ::wm::ANIMATE_HIDE); | |
| 469 ::wm::SetWindowVisibilityAnimationDuration( | |
| 470 bubble_widget->GetNativeWindow(), | |
| 471 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs)); | |
| 472 } | |
| 473 | |
| 474 aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const { | 473 aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const { |
| 475 return ash::Shell::GetContainer( | 474 return ash::Shell::GetContainer( |
| 476 tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(), | 475 tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(), |
| 477 ash::kShellWindowId_SettingBubbleContainer); | 476 ash::kShellWindowId_SettingBubbleContainer); |
| 478 } | 477 } |
| 479 | 478 |
| 480 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( | 479 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( |
| 481 views::Widget* anchor_widget, | 480 views::Widget* anchor_widget, |
| 482 TrayBubbleView::AnchorType anchor_type, | 481 TrayBubbleView::AnchorType anchor_type, |
| 483 TrayBubbleView::AnchorAlignment anchor_alignment) const { | 482 TrayBubbleView::AnchorAlignment anchor_alignment) const { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 background_->set_alpha(kTrayBackgroundAlpha); | 582 background_->set_alpha(kTrayBackgroundAlpha); |
| 584 SchedulePaint(); | 583 SchedulePaint(); |
| 585 } | 584 } |
| 586 | 585 |
| 587 void TrayBackgroundView::UpdateBubbleViewArrow( | 586 void TrayBackgroundView::UpdateBubbleViewArrow( |
| 588 views::TrayBubbleView* bubble_view) { | 587 views::TrayBubbleView* bubble_view) { |
| 589 // Nothing to do here. | 588 // Nothing to do here. |
| 590 } | 589 } |
| 591 | 590 |
| 592 } // namespace ash | 591 } // namespace ash |
| OLD | NEW |