explicit ShelfMenuModelAdapter(ShelfMenuModel* menu_model);
// views::MenuModelAdapter:
- virtual const gfx::FontList* GetLabelFontList(int command_id) const OVERRIDE;
- virtual bool IsCommandEnabled(int id) const OVERRIDE;
- virtual void GetHorizontalIconMargins(int id,
- int icon_size,
- int* left_margin,
- int* right_margin) const OVERRIDE;
- virtual bool GetForegroundColor(int command_id,
- bool is_hovered,
- SkColor* override_color) const OVERRIDE;
- virtual bool GetBackgroundColor(int command_id,
- bool is_hovered,
- SkColor* override_color) const OVERRIDE;
- virtual int GetMaxWidthForMenu(views::MenuItemView* menu) OVERRIDE;
- virtual bool ShouldReserveSpaceForSubmenuIndicator() const OVERRIDE;
+ const gfx::FontList* GetLabelFontList(int command_id) const override;
+ bool IsCommandEnabled(int id) const override;
+ void GetHorizontalIconMargins(int id,
+ int icon_size,
+ int* left_margin,
+ int* right_margin) const override;
+ bool GetForegroundColor(int command_id,
+ bool is_hovered,
+ SkColor* override_color) const override;
+ bool GetBackgroundColor(int command_id,
+ bool is_hovered,
+ SkColor* override_color) const override;
+ int GetMaxWidthForMenu(views::MenuItemView* menu) override;
+ bool ShouldReserveSpaceForSubmenuIndicator() const override;
private:
ShelfMenuModel* menu_model_;
explicit ShelfFocusSearch(views::ViewModel* view_model)
: FocusSearch(NULL, true, true),
view_model_(view_model) {}
- virtual ~ShelfFocusSearch() {}
+ ~ShelfFocusSearch() override {}
// views::FocusSearch overrides:
- virtual View* FindNextFocusableView(
- View* starting_view,
- bool reverse,
- Direction direction,
- bool check_starting_view,
- views::FocusTraversable** focus_traversable,
- View** focus_traversable_view) OVERRIDE {
+ View* FindNextFocusableView(View* starting_view,
+ bool reverse,
+ Direction direction,
+ bool check_starting_view,
+ views::FocusTraversable** focus_traversable,
+ View** focus_traversable_view) override {
int index = view_model_->GetIndexOfView(starting_view);
if (index == -1)
return view_model_->view_at(0);
class FadeInAnimationDelegate : public gfx::AnimationDelegate {
public:
explicit FadeInAnimationDelegate(views::View* view) : view_(view) {}
- virtual ~FadeInAnimationDelegate() {}
+ ~FadeInAnimationDelegate() override {}
// AnimationDelegate overrides:
- virtual void AnimationProgressed(const Animation* animation) OVERRIDE {
+ void AnimationProgressed(const Animation* animation) override {
view_->layer()->SetOpacity(animation->GetCurrentValue());
view_->layer()->ScheduleDraw();
}
- virtual void AnimationEnded(const Animation* animation) OVERRIDE {
+ void AnimationEnded(const Animation* animation) override {
view_->layer()->SetOpacity(1.0f);
view_->layer()->ScheduleDraw();
}
- virtual void AnimationCanceled(const Animation* animation) OVERRIDE {
+ void AnimationCanceled(const Animation* animation) override {
view_->layer()->SetOpacity(1.0f);
view_->layer()->ScheduleDraw();
}
FadeOutAnimationDelegate(ShelfView* host, views::View* view)
: shelf_view_(host),
view_(view) {}
- virtual ~FadeOutAnimationDelegate() {}
+ ~FadeOutAnimationDelegate() override {}
// AnimationDelegate overrides:
- virtual void AnimationProgressed(const Animation* animation) OVERRIDE {
+ void AnimationProgressed(const Animation* animation) override {
view_->layer()->SetOpacity(1 - animation->GetCurrentValue());
view_->layer()->ScheduleDraw();
}
- virtual void AnimationEnded(const Animation* animation) OVERRIDE {
+ void AnimationEnded(const Animation* animation) override {
shelf_view_->OnFadeOutAnimationEnded();
}
- virtual void AnimationCanceled(const Animation* animation) OVERRIDE {
- }
+ void AnimationCanceled(const Animation* animation) override {}
private:
ShelfView* shelf_view_;
views::View* view)
: shelf_view_(host),
view_(view) {}
- virtual ~StartFadeAnimationDelegate() {}
+ ~StartFadeAnimationDelegate() override {}
// AnimationDelegate overrides:
- virtual void AnimationEnded(const Animation* animation) OVERRIDE {
+ void AnimationEnded(const Animation* animation) override {
shelf_view_->FadeIn(view_);
}
- virtual void AnimationCanceled(const Animation* animation) OVERRIDE {
+ void AnimationCanceled(const Animation* animation) override {
view_->layer()->SetOpacity(1.0f);
}
index = last_visible_index_ + 1;
const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index));
DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type);
- ShelfButton* button = static_cast<ShelfButton*>(view_model_->view_at(index));
+ views::View* view = view_model_->view_at(index);
+ CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName());
+ ShelfButton* button = static_cast<ShelfButton*>(view);
gfx::Rect icon_bounds = button->GetIconBounds();
return gfx::Rect(GetMirroredXWithWidthInView(
ideal_bounds.x() + icon_bounds.x(), icon_bounds.width()),
int delta = CalculateShelfDistance(screen_location);
if (delta > kRipOffDistance) {
// Create a proxy view item which can be moved anywhere.
- ShelfButton* button = static_cast<ShelfButton*>(drag_view_);
CreateDragIconProxy(event.root_location(),
- button->GetImage(),
+ drag_view_->GetImage(),
drag_view_,
gfx::Vector2d(0, 0),
kDragAndDropProxyScale);
// animation end the flag gets cleared if |snap_back_from_rip_off_view_|
// is set.
snap_back_from_rip_off_view_ = drag_view_;
- ShelfButton* button = static_cast<ShelfButton*>(drag_view_);
- button->AddState(ShelfButton::STATE_HIDDEN);
+ drag_view_->AddState(ShelfButton::STATE_HIDDEN);
// When a canceling drag model is happening, the view model is diverged
// from the menu model and movements / animations should not be done.
model_->Move(current_index, start_drag_index_);
case TYPE_PLATFORM_APP:
case TYPE_DIALOG:
case TYPE_APP_PANEL: {
+ CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName());
ShelfButton* button = static_cast<ShelfButton*>(view);
ReflectItemStatus(item, button);
// The browser shortcut is currently not a "real" item and as such the
if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable())
return; // View is being deleted or not draggable, ignore request.
- drag_view_ = view;
+ CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName());
+ drag_view_ = static_cast<ShelfButton*>(view);
drag_origin_ = gfx::Point(event.x(), event.y());
UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentUsage",
layout_manager_->SelectValueForShelfAlignment(
for (int index = 0; index < view_model_->view_size(); index++) {
views::View* view = view_model_->view_at(index);
if (view == snap_back_from_rip_off_view_) {
+ CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName());
ShelfButton* button = static_cast<ShelfButton*>(view);
button->ClearState(ShelfButton::STATE_HIDDEN);
break;