Commit f118f1b6 authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

Cut off the icons outside of hotseat

A previous CL (https://crrev.com/c/2001745) only sets the rounded
corners of shelf container when the ink drop of the app icon is
activated by gesture. However, it misses the case that during scroll
animation the rounded corners are also needed. This CL enables the
rounded corners during hotseat scroll animation.

In addition, this CL utilizes shelf button delegate to call the host
view's function from shelf app button. It improves the code readability.

Bug: 1055992
Change-Id: I59285bd693ab6e8833f1f82f9212c7a5195ce3ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2076538Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746188}
parent d417a347
...@@ -669,33 +669,6 @@ views::View* ScrollableShelfView::GetShelfContainerViewForTest() { ...@@ -669,33 +669,6 @@ views::View* ScrollableShelfView::GetShelfContainerViewForTest() {
return shelf_container_view_; return shelf_container_view_;
} }
void ScrollableShelfView::SetRoundedCornersForShelf(
bool show,
views::View* ink_drop_host) {
shelf_container_view_->layer()->SetRoundedCornerRadius(
show && InkDropNeedsClipping(ink_drop_host)
? CalculateShelfContainerRoundedCorners()
: gfx::RoundedCornersF());
shelf_container_view_->layer()->SetIsFastRoundedCorner(true);
}
bool ScrollableShelfView::InkDropNeedsClipping(views::View* ink_drop_host) {
// The ink drop needs to be clipped only if the host is the app at one of the
// corners of the shelf. This happens if it is either the first or the last
// tappable app and no arrow is showing on its side.
if (shelf_view_->view_model()->view_at(first_tappable_app_index_) ==
ink_drop_host) {
return !(layout_strategy_ == kShowButtons ||
layout_strategy_ == kShowLeftArrowButton);
}
if (shelf_view_->view_model()->view_at(last_tappable_app_index_) ==
ink_drop_host) {
return !(layout_strategy_ == kShowButtons ||
layout_strategy_ == kShowRightArrowButton);
}
return false;
}
bool ScrollableShelfView::ShouldAdjustForTest() const { bool ScrollableShelfView::ShouldAdjustForTest() const {
return CalculateAdjustmentOffset(CalculateMainAxisScrollDistance(), return CalculateAdjustmentOffset(CalculateMainAxisScrollDistance(),
layout_strategy_, GetSpaceForIcons()); layout_strategy_, GetSpaceForIcons());
...@@ -747,6 +720,15 @@ void ScrollableShelfView::StartShelfScrollAnimation(float scroll_distance) { ...@@ -747,6 +720,15 @@ void ScrollableShelfView::StartShelfScrollAnimation(float scroll_distance) {
during_scroll_animation_ = true; during_scroll_animation_ = true;
MaybeUpdateGradientZone(); MaybeUpdateGradientZone();
// In tablet mode, if the target layout only has one arrow button, enable the
// rounded corners of the shelf container layer in order to cut off the icons
// outside of the hotseat background.
const bool one_arrow_in_target_state =
(layout_strategy_ == LayoutStrategy::kShowLeftArrowButton ||
layout_strategy_ == LayoutStrategy::kShowRightArrowButton);
if (one_arrow_in_target_state && Shell::Get()->IsInTabletMode())
EnableShelfRoundedCorners(/*enable=*/true);
ui::ScopedLayerAnimationSettings animation_settings( ui::ScopedLayerAnimationSettings animation_settings(
shelf_view_->layer()->GetAnimator()); shelf_view_->layer()->GetAnimator());
animation_settings.SetTweenType(gfx::Tween::EASE_OUT); animation_settings.SetTweenType(gfx::Tween::EASE_OUT);
...@@ -1091,6 +1073,16 @@ void ScrollableShelfView::HandleAccessibleActionScrollToMakeVisible( ...@@ -1091,6 +1073,16 @@ void ScrollableShelfView::HandleAccessibleActionScrollToMakeVisible(
} }
} }
void ScrollableShelfView::NotifyInkDropActivity(bool activated,
views::Button* sender) {
// When scrolling shelf by gestures, the shelf icon's ink drop ripple may be
// activated accidentally. So ignore the ink drop activity during animation.
if (during_scroll_animation_)
return;
EnableShelfRoundedCorners(activated && InkDropNeedsClipping(sender));
}
void ScrollableShelfView::ShowContextMenuForViewImpl( void ScrollableShelfView::ShowContextMenuForViewImpl(
views::View* source, views::View* source,
const gfx::Point& point, const gfx::Point& point,
...@@ -1291,6 +1283,8 @@ void ScrollableShelfView::OnImplicitAnimationsCompleted() { ...@@ -1291,6 +1283,8 @@ void ScrollableShelfView::OnImplicitAnimationsCompleted() {
during_scroll_animation_ = false; during_scroll_animation_ = false;
Layout(); Layout();
EnableShelfRoundedCorners(/*enable=*/false);
if (scroll_status_ != kAlongMainAxisScroll) if (scroll_status_ != kAlongMainAxisScroll)
UpdateTappableIconIndices(); UpdateTappableIconIndices();
...@@ -2095,21 +2089,21 @@ ScrollableShelfView::CalculateShelfContainerRoundedCorners() const { ...@@ -2095,21 +2089,21 @@ ScrollableShelfView::CalculateShelfContainerRoundedCorners() const {
const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment();
const float radius = (is_horizontal_alignment ? height() : width()) / 2.f; const float radius = (is_horizontal_alignment ? height() : width()) / 2.f;
int upper_left = left_arrow_->GetVisible() ? 0 : radius; int upper_left = ShouldShowLeftArrow() ? 0 : radius;
int upper_right; int upper_right;
if (is_horizontal_alignment) if (is_horizontal_alignment)
upper_right = right_arrow_->GetVisible() ? 0 : radius; upper_right = ShouldShowRightArrow() ? 0 : radius;
else else
upper_right = left_arrow_->GetVisible() ? 0 : radius; upper_right = ShouldShowLeftArrow() ? 0 : radius;
int lower_right = right_arrow_->GetVisible() ? 0 : radius; int lower_right = ShouldShowRightArrow() ? 0 : radius;
int lower_left; int lower_left;
if (is_horizontal_alignment) if (is_horizontal_alignment)
lower_left = left_arrow_->GetVisible() ? 0 : radius; lower_left = ShouldShowLeftArrow() ? 0 : radius;
else else
lower_left = right_arrow_->GetVisible() ? 0 : radius; lower_left = ShouldShowRightArrow() ? 0 : radius;
if (ShouldAdaptToRTL()) { if (ShouldAdaptToRTL()) {
std::swap(upper_left, upper_right); std::swap(upper_left, upper_right);
...@@ -2252,4 +2246,33 @@ int ScrollableShelfView::CalculateScrollOffsetForTargetAvailableSpace( ...@@ -2252,4 +2246,33 @@ int ScrollableShelfView::CalculateScrollOffsetForTargetAvailableSpace(
return target_scroll_offset; return target_scroll_offset;
} }
bool ScrollableShelfView::InkDropNeedsClipping(views::Button* sender) const {
// The ink drop needs to be clipped only if |sender| is the app at one of the
// corners of the shelf. This happens if it is either the first or the last
// tappable app and no arrow is showing on its side.
if (shelf_view_->view_model()->view_at(first_tappable_app_index_) == sender) {
return !(layout_strategy_ == kShowButtons ||
layout_strategy_ == kShowLeftArrowButton);
}
if (shelf_view_->view_model()->view_at(last_tappable_app_index_) == sender) {
return !(layout_strategy_ == kShowButtons ||
layout_strategy_ == kShowRightArrowButton);
}
return false;
}
void ScrollableShelfView::EnableShelfRoundedCorners(bool enable) {
ui::Layer* layer = shelf_container_view_->layer();
const bool has_rounded_corners = !(layer->rounded_corner_radii().IsEmpty());
if (enable == has_rounded_corners)
return;
layer->SetRoundedCornerRadius(enable ? CalculateShelfContainerRoundedCorners()
: gfx::RoundedCornersF());
if (!layer->is_fast_rounded_corner())
layer->SetIsFastRoundedCorner(/*enable=*/true);
}
} // namespace ash } // namespace ash
...@@ -96,10 +96,6 @@ class ASH_EXPORT ScrollableShelfView : public views::AccessiblePaneView, ...@@ -96,10 +96,6 @@ class ASH_EXPORT ScrollableShelfView : public views::AccessiblePaneView,
void SetTestObserver(TestObserver* test_observer); void SetTestObserver(TestObserver* test_observer);
void SetRoundedCornersForShelf(bool show, views::View* ink_drop_host);
// Returns whether the ink drop for the |ink_drop_host| needs to be clipped.
bool InkDropNeedsClipping(views::View* ink_drop_host);
ShelfView* shelf_view() { return shelf_view_; } ShelfView* shelf_view() { return shelf_view_; }
ShelfContainerView* shelf_container_view() { return shelf_container_view_; } ShelfContainerView* shelf_container_view() { return shelf_container_view_; }
const ShelfContainerView* shelf_container_view() const { const ShelfContainerView* shelf_container_view() const {
...@@ -214,6 +210,7 @@ class ASH_EXPORT ScrollableShelfView : public views::AccessiblePaneView, ...@@ -214,6 +210,7 @@ class ASH_EXPORT ScrollableShelfView : public views::AccessiblePaneView,
const ui::Event& event, const ui::Event& event,
views::InkDrop* ink_drop) override; views::InkDrop* ink_drop) override;
void HandleAccessibleActionScrollToMakeVisible(ShelfButton* button) override; void HandleAccessibleActionScrollToMakeVisible(ShelfButton* button) override;
void NotifyInkDropActivity(bool activated, views::Button* sender) override;
// ContextMenuController: // ContextMenuController:
void ShowContextMenuForViewImpl(views::View* source, void ShowContextMenuForViewImpl(views::View* source,
...@@ -434,6 +431,12 @@ class ASH_EXPORT ScrollableShelfView : public views::AccessiblePaneView, ...@@ -434,6 +431,12 @@ class ASH_EXPORT ScrollableShelfView : public views::AccessiblePaneView,
int CalculateScrollOffsetForTargetAvailableSpace( int CalculateScrollOffsetForTargetAvailableSpace(
const gfx::Rect& target_space) const; const gfx::Rect& target_space) const;
// Returns whether the ink drop for the |sender| needs to be clipped.
bool InkDropNeedsClipping(views::Button* sender) const;
// Enable/disable the rounded corners of the shelf container.
void EnableShelfRoundedCorners(bool enable);
LayoutStrategy layout_strategy_ = kNotShowArrowButtons; LayoutStrategy layout_strategy_ = kNotShowArrowButtons;
// Child views Owned by views hierarchy. // Child views Owned by views hierarchy.
......
...@@ -502,17 +502,25 @@ class HotseatScrollableShelfViewTest : public ScrollableShelfViewTest { ...@@ -502,17 +502,25 @@ class HotseatScrollableShelfViewTest : public ScrollableShelfViewTest {
scoped_feature_list_.Reset(); scoped_feature_list_.Reset();
} }
bool HasRoundedCornersOnLongTapAtLocation(gfx::Point location) { bool HasRoundedCornersOnAppButtonAfterMouseRightClick(
GetEventGenerator()->MoveTouch(location); ShelfAppButton* button) {
GetEventGenerator()->PressTouch(); const gfx::Point location_within_button =
button->GetBoundsInScreen().CenterPoint();
GetEventGenerator()->MoveMouseTo(location_within_button);
GetEventGenerator()->ClickRightButton();
ui::Layer* layer = scrollable_shelf_view_->shelf_container_view()->layer();
// The gfx::RoundedCornersF object is considered empty when all of the // The gfx::RoundedCornersF object is considered empty when all of the
// corners are squared (no effective radius). // corners are squared (no effective radius).
bool has_rounded_corners = !(scrollable_shelf_view_->shelf_container_view() const bool has_rounded_corners = !(layer->rounded_corner_radii().IsEmpty());
->layer()
->rounded_corner_radii() // Click outside of |button|. Expects that the rounded corners should always
.IsEmpty()); // be empty.
GetEventGenerator()->ReleaseTouch(); GetEventGenerator()->GestureTapAt(
button->GetBoundsInScreen().bottom_center());
EXPECT_TRUE(layer->rounded_corner_radii().IsEmpty());
return has_rounded_corners; return has_rounded_corners;
} }
...@@ -610,29 +618,20 @@ TEST_F(HotseatScrollableShelfViewTest, CheckRoundedCornersSetForInkDrop) { ...@@ -610,29 +618,20 @@ TEST_F(HotseatScrollableShelfViewTest, CheckRoundedCornersSetForInkDrop) {
->rounded_corner_radii() ->rounded_corner_radii()
.IsEmpty()); .IsEmpty());
views::ViewModel* view_model = shelf_view_->view_model(); ShelfViewTestAPI shelf_view_test_api(shelf_view_);
gfx::Rect first_tappable_view_bounds =
view_model->view_at(scrollable_shelf_view_->first_tappable_app_index()) ShelfAppButton* first_icon = shelf_view_test_api.GetButton(
->GetBoundsInScreen(); scrollable_shelf_view_->first_tappable_app_index());
gfx::Rect last_tappable_view_bounds = ShelfAppButton* last_icon = shelf_view_test_api.GetButton(
view_model->view_at(scrollable_shelf_view_->last_tappable_app_index()) scrollable_shelf_view_->last_tappable_app_index());
->GetBoundsInScreen();
// When the right arrow is showing, check rounded corners are set if the ink // When the right arrow is showing, check rounded corners are set if the ink
// drop is visible for the first visible app. // drop is visible for the first visible app.
EXPECT_TRUE(HasRoundedCornersOnLongTapAtLocation( EXPECT_TRUE(HasRoundedCornersOnAppButtonAfterMouseRightClick(first_icon));
first_tappable_view_bounds.CenterPoint()));
// Tap outside the app and verify that rounded corners are not set if the ink
// drop is hidden.
GetEventGenerator()->GestureTapAt(first_tappable_view_bounds.bottom_center());
EXPECT_TRUE(scrollable_shelf_view_->shelf_container_view()
->layer()
->rounded_corner_radii()
.IsEmpty());
// When the right arrow is showing, check rounded corners are not set if the // When the right arrow is showing, check rounded corners are not set if the
// ink drop is visible for the last visible app // ink drop is visible for the last visible app
EXPECT_FALSE(HasRoundedCornersOnLongTapAtLocation( EXPECT_FALSE(HasRoundedCornersOnAppButtonAfterMouseRightClick(last_icon));
last_tappable_view_bounds.CenterPoint()));
// Tap right arrow. Hotseat layout must now show left arrow. // Tap right arrow. Hotseat layout must now show left arrow.
gfx::Rect right_arrow = gfx::Rect right_arrow =
...@@ -641,29 +640,19 @@ TEST_F(HotseatScrollableShelfViewTest, CheckRoundedCornersSetForInkDrop) { ...@@ -641,29 +640,19 @@ TEST_F(HotseatScrollableShelfViewTest, CheckRoundedCornersSetForInkDrop) {
ASSERT_EQ(ScrollableShelfView::kShowLeftArrowButton, ASSERT_EQ(ScrollableShelfView::kShowLeftArrowButton,
scrollable_shelf_view_->layout_strategy_for_test()); scrollable_shelf_view_->layout_strategy_for_test());
// Recalculate first and last view bounds. // Recalculate first and last icons.
first_tappable_view_bounds = first_icon = shelf_view_test_api.GetButton(
view_model->view_at(scrollable_shelf_view_->first_tappable_app_index()) scrollable_shelf_view_->first_tappable_app_index());
->GetBoundsInScreen(); last_icon = shelf_view_test_api.GetButton(
last_tappable_view_bounds = scrollable_shelf_view_->last_tappable_app_index());
view_model->view_at(scrollable_shelf_view_->last_tappable_app_index())
->GetBoundsInScreen();
// When the left arrow is showing, check rounded corners are set if the ink // When the left arrow is showing, check rounded corners are set if the ink
// drop is visible for the last visible app. // drop is visible for the last visible app.
EXPECT_TRUE(HasRoundedCornersOnLongTapAtLocation( EXPECT_TRUE(HasRoundedCornersOnAppButtonAfterMouseRightClick(last_icon));
last_tappable_view_bounds.CenterPoint()));
// Tap outside the app and verify that rounded corners are not set if the ink
// drop is hidden.
GetEventGenerator()->GestureTapAt(last_tappable_view_bounds.bottom_center());
EXPECT_TRUE(scrollable_shelf_view_->shelf_container_view()
->layer()
->rounded_corner_radii()
.IsEmpty());
// When the left arrow is showing, check rounded corners are not set if the // When the left arrow is showing, check rounded corners are not set if the
// ink drop is visible for the first visible app // ink drop is visible for the first visible app
EXPECT_FALSE(HasRoundedCornersOnLongTapAtLocation( EXPECT_FALSE(HasRoundedCornersOnAppButtonAfterMouseRightClick(first_icon));
first_tappable_view_bounds.CenterPoint()));
} }
// Verifies that doing a mousewheel scroll on the scrollable shelf does scroll // Verifies that doing a mousewheel scroll on the scrollable shelf does scroll
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/shelf/hotseat_widget.h" #include "ash/shelf/hotseat_widget.h"
#include "ash/shelf/scrollable_shelf_view.h"
#include "ash/shelf/shelf_controller.h" #include "ash/shelf/shelf_controller.h"
#include "ash/shelf/shelf_focus_cycler.h" #include "ash/shelf/shelf_focus_cycler.h"
#include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_layout_manager.h"
...@@ -529,15 +528,6 @@ void Shelf::SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds) { ...@@ -529,15 +528,6 @@ void Shelf::SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds) {
work_area_insets->OnKeyboardAppearanceChanged(state); work_area_insets->OnKeyboardAppearanceChanged(state);
} }
void Shelf::SetRoundedCornersForInkDrop(bool show, views::View* ink_drop_host) {
if (!shelf_widget_->hotseat_widget() ||
!shelf_widget_->hotseat_widget()->scrollable_shelf_view())
return;
shelf_widget_->hotseat_widget()
->scrollable_shelf_view()
->SetRoundedCornersForShelf(show, ink_drop_host);
}
ShelfLockingManager* Shelf::GetShelfLockingManagerForTesting() { ShelfLockingManager* Shelf::GetShelfLockingManagerForTesting() {
return &shelf_locking_manager_; return &shelf_locking_manager_;
} }
......
...@@ -29,10 +29,6 @@ class MouseEvent; ...@@ -29,10 +29,6 @@ class MouseEvent;
class ScrollEvent; class ScrollEvent;
} // namespace ui } // namespace ui
namespace views {
class View;
}
namespace ash { namespace ash {
enum class AnimationChangeType; enum class AnimationChangeType;
...@@ -200,7 +196,6 @@ class ASH_EXPORT Shelf : public ShelfLayoutManagerObserver { ...@@ -200,7 +196,6 @@ class ASH_EXPORT Shelf : public ShelfLayoutManagerObserver {
bool ShouldHideOnSecondaryDisplay(session_manager::SessionState state); bool ShouldHideOnSecondaryDisplay(session_manager::SessionState state);
void SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds); void SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds);
void SetRoundedCornersForInkDrop(bool show, views::View* ink_drop_host);
ShelfLockingManager* GetShelfLockingManagerForTesting(); ShelfLockingManager* GetShelfLockingManagerForTesting();
ShelfView* GetShelfViewForTesting(); ShelfView* GetShelfViewForTesting();
......
...@@ -704,17 +704,6 @@ void ShelfAppButton::ChildPreferredSizeChanged(views::View* child) { ...@@ -704,17 +704,6 @@ void ShelfAppButton::ChildPreferredSizeChanged(views::View* child) {
Layout(); Layout();
} }
void ShelfAppButton::InkDropAnimationStarted() {
shelf_view_->shelf()->SetRoundedCornersForInkDrop(/*show=*/true,
/*ink_drop_host=*/this);
}
void ShelfAppButton::InkDropRippleAnimationEnded(views::InkDropState state) {
if (state == views::InkDropState::HIDDEN)
shelf_view_->shelf()->SetRoundedCornersForInkDrop(/*show=*/false,
/*ink_drop_host=*/this);
}
void ShelfAppButton::OnGestureEvent(ui::GestureEvent* event) { void ShelfAppButton::OnGestureEvent(ui::GestureEvent* event) {
switch (event->type()) { switch (event->type()) {
case ui::ET_GESTURE_TAP_DOWN: case ui::ET_GESTURE_TAP_DOWN:
...@@ -814,6 +803,17 @@ bool ShelfAppButton::HandleAccessibleAction( ...@@ -814,6 +803,17 @@ bool ShelfAppButton::HandleAccessibleAction(
return views::View::HandleAccessibleAction(action_data); return views::View::HandleAccessibleAction(action_data);
} }
void ShelfAppButton::InkDropAnimationStarted() {
SetInkDropAnimationStarted(/*started=*/true);
}
void ShelfAppButton::InkDropRippleAnimationEnded(views::InkDropState state) {
// Notify the host view of the ink drop to be hidden at the end of ink drop
// animation.
if (state == views::InkDropState::HIDDEN)
SetInkDropAnimationStarted(/*started=*/false);
}
void ShelfAppButton::UpdateState() { void ShelfAppButton::UpdateState() {
indicator_->SetVisible(!(state_ & STATE_HIDDEN) && indicator_->SetVisible(!(state_ & STATE_HIDDEN) &&
(state_ & STATE_ATTENTION || state_ & STATE_RUNNING || (state_ & STATE_ATTENTION || state_ & STATE_RUNNING ||
...@@ -877,4 +877,12 @@ void ShelfAppButton::OnImplicitAnimationsCompleted() { ...@@ -877,4 +877,12 @@ void ShelfAppButton::OnImplicitAnimationsCompleted() {
icon_view_->layer()->SetTransform(gfx::Transform()); icon_view_->layer()->SetTransform(gfx::Transform());
} }
void ShelfAppButton::SetInkDropAnimationStarted(bool started) {
if (ink_drop_animation_started_ == started)
return;
ink_drop_animation_started_ = started;
shelf_button_delegate()->NotifyInkDropActivity(started, /*sender=*/this);
}
} // namespace ash } // namespace ash
...@@ -94,10 +94,6 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton, ...@@ -94,10 +94,6 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton,
void Layout() override; void Layout() override;
void ChildPreferredSizeChanged(views::View* child) override; void ChildPreferredSizeChanged(views::View* child) override;
// views::InkDropListener:
void InkDropAnimationStarted() override;
void InkDropRippleAnimationEnded(views::InkDropState state) override;
// Update button state from ShelfItem. // Update button state from ShelfItem.
void ReflectItemStatus(const ShelfItem& item); void ReflectItemStatus(const ShelfItem& item);
...@@ -131,6 +127,10 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton, ...@@ -131,6 +127,10 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton,
// views::View: // views::View:
bool HandleAccessibleAction(const ui::AXActionData& action_data) override; bool HandleAccessibleAction(const ui::AXActionData& action_data) override;
// views::InkDropObserver:
void InkDropAnimationStarted() override;
void InkDropRippleAnimationEnded(views::InkDropState state) override;
// Updates the parts of the button to reflect the current |state_| and // Updates the parts of the button to reflect the current |state_| and
// alignment. This may add or remove views, layout and paint. // alignment. This may add or remove views, layout and paint.
void UpdateState(); void UpdateState();
...@@ -152,6 +152,9 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton, ...@@ -152,6 +152,9 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton,
// normal size icon. // normal size icon.
gfx::Transform GetScaleTransform(float icon_scale); gfx::Transform GetScaleTransform(float icon_scale);
// Marks whether the ink drop animation has started or not.
void SetInkDropAnimationStarted(bool started);
// The icon part of a button can be animated independently of the rest. // The icon part of a button can be animated independently of the rest.
views::ImageView* icon_view_; views::ImageView* icon_view_;
...@@ -184,6 +187,9 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton, ...@@ -184,6 +187,9 @@ class ASH_EXPORT ShelfAppButton : public ShelfButton,
// The scaling factor for displaying the app icon. // The scaling factor for displaying the app icon.
float icon_scale_ = 1.0f; float icon_scale_ = 1.0f;
// Indicates whether the ink drop animation starts.
bool ink_drop_animation_started_ = false;
// A timer to defer showing drag UI when the shelf button is pressed. // A timer to defer showing drag UI when the shelf button is pressed.
base::OneShotTimer drag_timer_; base::OneShotTimer drag_timer_;
......
...@@ -47,6 +47,9 @@ class ShelfButtonDelegate { ...@@ -47,6 +47,9 @@ class ShelfButtonDelegate {
// focus. // focus.
virtual void HandleAccessibleActionScrollToMakeVisible(ShelfButton* button) {} virtual void HandleAccessibleActionScrollToMakeVisible(ShelfButton* button) {}
// Notify the host view of the change in |sender|'s ink drop view.
virtual void NotifyInkDropActivity(bool activated, views::Button* sender) {}
private: private:
DISALLOW_COPY_AND_ASSIGN(ShelfButtonDelegate); DISALLOW_COPY_AND_ASSIGN(ShelfButtonDelegate);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment