diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-26 21:48:16 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-26 21:48:16 +0000 |
commit | 72b71bb021c1594f013ef4789a6e860494ecac6d (patch) | |
tree | 3dcb761b186b22956b5da1fa014a6fe7d8c8e967 /ash | |
parent | 86901182346f454e2598753c88ede26c7d41f476 (diff) | |
download | chromium_src-72b71bb021c1594f013ef4789a6e860494ecac6d.zip chromium_src-72b71bb021c1594f013ef4789a6e860494ecac6d.tar.gz chromium_src-72b71bb021c1594f013ef4789a6e860494ecac6d.tar.bz2 |
Revert 164398 - Hides the bubble arrow when showing a tray bubble and the launcher is
hidden. Additionally makes the bubble track the launcher.
BUG=157899
TEST=none
R=sadrul@chromium.org,msw@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11270051
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/11306010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/shell.h | 1 | ||||
-rw-r--r-- | ash/system/tray/tray_background_view.cc | 35 | ||||
-rw-r--r-- | ash/system/tray/tray_background_view.h | 7 | ||||
-rw-r--r-- | ash/system/tray/tray_bubble_view.cc | 11 | ||||
-rw-r--r-- | ash/wm/shelf_layout_manager.h | 4 |
5 files changed, 35 insertions, 23 deletions
diff --git a/ash/shell.h b/ash/shell.h index d744b2a..0a29535 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -97,6 +97,7 @@ class RootWindowController; class RootWindowLayoutManager; class ScreenPositionController; class ShadowController; +class ShelfLayoutManager; class SlowAnimationEventFilter; class StackingController; class StatusAreaWidget; diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index 6abc2be..e044182 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc @@ -15,6 +15,7 @@ #include "ui/aura/event_filter.h" #include "ui/aura/window.h" #include "ui/base/accessibility/accessible_view_state.h" +#include "ui/compositor/layer_animation_observer.h" #include "ui/gfx/canvas.h" #include "ui/gfx/screen.h" #include "ui/gfx/skia_util.h" @@ -41,22 +42,31 @@ using message_center::TrayBubbleView; namespace ash { namespace internal { -// Used to track when the anchor widget changes position on screen so that the -// bubble position can be updated. -class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { +// Observe the tray layer animation and update the anchor when it changes. +// TODO(stevenjb): Observe or mirror the actual animation, not just the start +// and end points. +class TrayLayerAnimationObserver : public ui::LayerAnimationObserver { public: - explicit TrayWidgetObserver(TrayBackgroundView* host) + explicit TrayLayerAnimationObserver(TrayBackgroundView* host) : host_(host) { } - virtual void OnWidgetMoved(views::Widget* widget) OVERRIDE { + virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) { + host_->AnchorUpdated(); + } + + virtual void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) { + host_->AnchorUpdated(); + } + + virtual void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) { host_->AnchorUpdated(); } private: TrayBackgroundView* host_; - DISALLOW_COPY_AND_ASSIGN(TrayWidgetObserver); + DISALLOW_COPY_AND_ASSIGN(TrayLayerAnimationObserver); }; class TrayBackground : public views::Background { @@ -159,8 +169,8 @@ TrayBackgroundView::TrayBackgroundView( this, 0, kTrayBackgroundAlpha)), ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_( this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)), - ALLOW_THIS_IN_INITIALIZER_LIST(widget_observer_( - new TrayWidgetObserver(this))) { + ALLOW_THIS_IN_INITIALIZER_LIST(layer_animation_observer_( + new TrayLayerAnimationObserver(this))) { set_notify_enter_exit_on_child(true); // Initially we want to paint the background, but without the hover effect. @@ -173,12 +183,15 @@ TrayBackgroundView::TrayBackgroundView( } TrayBackgroundView::~TrayBackgroundView() { - if (GetWidget()) - GetWidget()->RemoveObserver(widget_observer_.get()); + if (GetWidget()) { + GetWidget()->GetNativeView()->layer()->GetAnimator()->RemoveObserver( + layer_animation_observer_.get()); + } } void TrayBackgroundView::Initialize() { - GetWidget()->AddObserver(widget_observer_.get()); + GetWidget()->GetNativeView()->layer()->GetAnimator()->AddObserver( + layer_animation_observer_.get()); SetBorder(); } diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h index f95a8a2..97ee8d3 100644 --- a/ash/system/tray/tray_background_view.h +++ b/ash/system/tray/tray_background_view.h @@ -17,6 +17,8 @@ namespace internal { class ShelfLayoutManager; class StatusAreaWidget; class TrayBackground; +class TrayLayerAnimationObserver; + // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. // This class handles setting and animating the background when the Launcher // his shown/hidden. It also inherits from ActionableView so that the tray @@ -133,7 +135,7 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, ShelfLayoutManager* GetShelfLayoutManager(); private: - class TrayWidgetObserver; + friend class TrayLayerAnimationObserver; // Called from Initialize after all status area trays have been created. // Sets the border based on the position of the view. @@ -153,7 +155,8 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, internal::BackgroundAnimator hide_background_animator_; internal::BackgroundAnimator hover_background_animator_; - scoped_ptr<TrayWidgetObserver> widget_observer_; + scoped_ptr<internal::TrayLayerAnimationObserver> + layer_animation_observer_; DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); }; diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index b25db99..145241c 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc @@ -4,15 +4,11 @@ #include "ash/system/tray/tray_bubble_view.h" -#include "ash/root_window_controller.h" -#include "ash/wm/property_util.h" -#include "ash/wm/shelf_layout_manager.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/effects/SkBlurImageFilter.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/events/event.h" @@ -239,7 +235,6 @@ TrayBubbleView::InitParams::InitParams(AnchorType anchor_type, shadow(views::BubbleBorder::BIG_SHADOW) { } -// static TrayBubbleView* TrayBubbleView::Create(aura::Window* parent_window, views::View* anchor, Delegate* delegate, @@ -281,7 +276,7 @@ TrayBubbleView::TrayBubbleView(aura::Window* parent_window, bubble_border_ = new TrayBubbleBorder(this, anchor_view(), params_); bubble_background_ = new TrayBubbleBackground( - bubble_border_, init_params.top_color, init_params.arrow_color); + bubble_border_, init_params.top_color, init_params.arrow_color); // Inset the view on the top and bottom by the corner radius to avoid drawing // over the the bubble corners. @@ -307,10 +302,6 @@ void TrayBubbleView::InitializeAndShowBubble() { void TrayBubbleView::UpdateBubble() { SizeToContents(); GetWidget()->GetRootView()->SchedulePaint(); - aura::RootWindow* root_window = GetWidget()->GetNativeView()->GetRootWindow(); - const bool is_launcher_visible = - ash::GetRootWindowController(root_window)->shelf()->IsVisible(); - bubble_border_->set_paint_arrow(is_launcher_visible); } void TrayBubbleView::SetMaxHeight(int height) { diff --git a/ash/wm/shelf_layout_manager.h b/ash/wm/shelf_layout_manager.h index 27d076e..6b9eb08 100644 --- a/ash/wm/shelf_layout_manager.h +++ b/ash/wm/shelf_layout_manager.h @@ -76,6 +76,10 @@ class ASH_EXPORT ShelfLayoutManager : // We reserve a small area at the bottom of the workspace area to ensure that // the bottom-of-window resize handle can be hit. + // TODO(jamescook): Some day we may want the workspace area to be an even + // multiple of the size of the grid (currently 8 pixels), which will require + // removing this and finding a way for hover and click events to pass through + // the invisible parts of the launcher. static const int kWorkspaceAreaBottomInset; // Size of the shelf when auto-hidden. |