| Index: ash/system/tray/tray_background_view.cc
|
| diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
|
| index ec269d298b1c80a9d90659bdf29f99a23b9704c1..c71912721a917644d587e4723d8cdc78652cf546 100644
|
| --- a/ash/system/tray/tray_background_view.cc
|
| +++ b/ash/system/tray/tray_background_view.cc
|
| @@ -16,6 +16,7 @@
|
| #include "ash/system/tray/tray_constants.h"
|
| #include "ash/system/tray/tray_container.h"
|
| #include "ash/system/tray/tray_event_filter.h"
|
| +#include "ash/wm/maximize_mode/maximize_mode_controller.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "ui/accessibility/ax_node_data.h"
|
| #include "ui/compositor/layer.h"
|
| @@ -130,6 +131,26 @@ class TrayBackground : public views::Background {
|
| DISALLOW_COPY_AND_ASSIGN(TrayBackground);
|
| };
|
|
|
| +// CloseBubbleObserver is used to delay closing the tray bubbles until the
|
| +// animation completes.
|
| +class CloseBubbleObserver : public ui::ImplicitAnimationObserver {
|
| + public:
|
| + explicit CloseBubbleObserver(TrayBackgroundView* tray_background_view)
|
| + : tray_background_view_(tray_background_view) {}
|
| +
|
| + ~CloseBubbleObserver() override {}
|
| +
|
| + void OnImplicitAnimationsCompleted() override {
|
| + tray_background_view_->CloseBubble();
|
| + delete this;
|
| + }
|
| +
|
| + private:
|
| + TrayBackgroundView* tray_background_view_ = nullptr;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(CloseBubbleObserver);
|
| +};
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // TrayBackgroundView
|
|
|
| @@ -236,13 +257,12 @@ const char* TrayBackgroundView::GetClassName() const {
|
| return kViewClassName;
|
| }
|
|
|
| -void TrayBackgroundView::ChildPreferredSizeChanged(views::View* child) {
|
| - PreferredSizeChanged();
|
| -}
|
| +void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) {
|
| + if (drag_controller())
|
| + drag_controller_->ProcessGestureEvent(event, this);
|
|
|
| -void TrayBackgroundView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
|
| - ActionableView::GetAccessibleNodeData(node_data);
|
| - node_data->SetName(GetAccessibleNameForTray());
|
| + if (!event->handled())
|
| + ActionableView::OnGestureEvent(event);
|
| }
|
|
|
| void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) {
|
| @@ -252,6 +272,15 @@ void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) {
|
| Shell::Get()->system_tray_notifier()->NotifyFocusOut(reverse);
|
| }
|
|
|
| +void TrayBackgroundView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
|
| + ActionableView::GetAccessibleNodeData(node_data);
|
| + node_data->SetName(GetAccessibleNameForTray());
|
| +}
|
| +
|
| +void TrayBackgroundView::ChildPreferredSizeChanged(views::View* child) {
|
| + PreferredSizeChanged();
|
| +}
|
| +
|
| std::unique_ptr<views::InkDropRipple> TrayBackgroundView::CreateInkDropRipple()
|
| const {
|
| return base::MakeUnique<views::FloodFillInkDropRipple>(
|
| @@ -306,6 +335,19 @@ void TrayBackgroundView::PaintButtonContents(gfx::Canvas* canvas) {
|
| }
|
| }
|
|
|
| +void TrayBackgroundView::ProcessGestureEventForBubble(ui::GestureEvent* event) {
|
| + if (drag_controller())
|
| + drag_controller_->ProcessGestureEvent(event, this);
|
| +}
|
| +
|
| +TrayBubbleView* TrayBackgroundView::GetBubbleView() {
|
| + return nullptr;
|
| +}
|
| +
|
| +void TrayBackgroundView::CloseBubble() {}
|
| +
|
| +void TrayBackgroundView::ShowBubble() {}
|
| +
|
| void TrayBackgroundView::UpdateAfterShelfAlignmentChange() {
|
| tray_container_->UpdateAfterShelfAlignmentChange();
|
|
|
| @@ -319,6 +361,11 @@ void TrayBackgroundView::UpdateAfterShelfAlignmentChange() {
|
| GetLocalBounds().InsetsFrom(paint_bounds)));
|
| }
|
|
|
| +void TrayBackgroundView::AnchorUpdated() {}
|
| +
|
| +void TrayBackgroundView::BubbleResized(
|
| + const views::TrayBubbleView* bubble_view) {}
|
| +
|
| void TrayBackgroundView::OnImplicitAnimationsCompleted() {
|
| // If there is another animation in the queue, the reverse animation was
|
| // triggered before the completion of animating to invisible. Do not turn off
|
| @@ -392,10 +439,43 @@ gfx::Insets TrayBackgroundView::GetBubbleAnchorInsets() const {
|
| }
|
| }
|
|
|
| -aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const {
|
| - return Shell::GetContainer(
|
| +aura::Window* TrayBackgroundView::GetBubbleWindowContainer() {
|
| + aura::Window* container = Shell::GetContainer(
|
| tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(),
|
| kShellWindowId_SettingBubbleContainer);
|
| +
|
| + // Place the bubble in |container|, or in a window clipped to the work area
|
| + // in maximize mode, to avoid tray bubble and shelf overlap.
|
| + if (Shell::Get()
|
| + ->maximize_mode_controller()
|
| + ->IsMaximizeModeWindowManagerEnabled()) {
|
| + if (!clipping_window_.get()) {
|
| + clipping_window_ = base::MakeUnique<aura::Window>(nullptr);
|
| + clipping_window_->Init(ui::LAYER_NOT_DRAWN);
|
| + clipping_window_->layer()->SetMasksToBounds(true);
|
| + container->AddChild(clipping_window_.get());
|
| + clipping_window_->Show();
|
| + }
|
| + clipping_window_->SetBounds(shelf_->GetUserWorkAreaBounds());
|
| + return clipping_window_.get();
|
| + }
|
| + return container;
|
| +}
|
| +
|
| +void TrayBackgroundView::AnimateToTargetBounds(const gfx::Rect& target_bounds,
|
| + bool close_bubble) {
|
| + const int kAnimationDurationMS = 200;
|
| +
|
| + ui::ScopedLayerAnimationSettings settings(
|
| + GetBubbleView()->GetWidget()->GetNativeView()->layer()->GetAnimator());
|
| + settings.SetTransitionDuration(
|
| + base::TimeDelta::FromMilliseconds(kAnimationDurationMS));
|
| + settings.SetTweenType(gfx::Tween::EASE_OUT);
|
| + settings.SetPreemptionStrategy(
|
| + ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
|
| + if (close_bubble)
|
| + settings.AddObserver(new CloseBubbleObserver(this));
|
| + GetBubbleView()->GetWidget()->SetBounds(target_bounds);
|
| }
|
|
|
| std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask()
|
|
|