| Index: ui/aura_shell/launcher/launcher_view.cc
|
| diff --git a/ui/aura_shell/launcher/launcher_view.cc b/ui/aura_shell/launcher/launcher_view.cc
|
| index 727c9fce84574c19d757ffec8d8ff803da4fe518..7dcc5a50e10c1360fcdda952b749807d63acf5a0 100644
|
| --- a/ui/aura_shell/launcher/launcher_view.cc
|
| +++ b/ui/aura_shell/launcher/launcher_view.cc
|
| @@ -82,48 +82,6 @@ class MenuDelegateImpl : public ui::SimpleMenuModel::Delegate {
|
| DISALLOW_COPY_AND_ASSIGN(MenuDelegateImpl);
|
| };
|
|
|
| -// ImageButton subclass that animates transition changes using the opacity of
|
| -// the layer.
|
| -class FadeButton : public views::ImageButton {
|
| - public:
|
| - explicit FadeButton(views::ButtonListener* listener)
|
| - : ImageButton(listener) {
|
| - SetPaintToLayer(true);
|
| - layer()->SetFillsBoundsOpaquely(false);
|
| - layer()->SetOpacity(kDimmedButtonOpacity);
|
| - }
|
| -
|
| - protected:
|
| - // ImageButton overrides:
|
| - virtual SkBitmap GetImageToPaint() OVERRIDE {
|
| - // ImageButton::GetImageToPaint returns an alpha blended image based on
|
| - // hover_animation_. FadeButton uses hover_animation to change the opacity
|
| - // of the layer, so this can be overriden to return the normal image always.
|
| - return images_[BS_NORMAL];
|
| - }
|
| - virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE {
|
| - layer()->SetOpacity(kDimmedButtonOpacity + (1.0f - kDimmedButtonOpacity) *
|
| - animation->GetCurrentValue());
|
| - layer()->ScheduleDraw();
|
| - }
|
| - virtual void StateChanged() OVERRIDE {
|
| - if (!hover_animation_->is_animating()) {
|
| - float opacity = state_ == BS_NORMAL ? kDimmedButtonOpacity : 1.0f;
|
| - if (layer()->opacity() != opacity) {
|
| - layer()->SetOpacity(opacity);
|
| - layer()->ScheduleDraw();
|
| - }
|
| - }
|
| - }
|
| - virtual void SchedulePaint() OVERRIDE {
|
| - // All changes we care about trigger a draw on the layer, so this can be
|
| - // overriden to do nothing.
|
| - }
|
| -
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(FadeButton);
|
| -};
|
| -
|
| // AnimationDelegate that deletes a view when done. This is used when a launcher
|
| // item is removed, which triggers a remove animation. When the animation is
|
| // done we delete the view.
|
| @@ -246,10 +204,12 @@ LauncherView::~LauncherView() {
|
| void LauncherView::Init() {
|
| model_->AddObserver(this);
|
| ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| - new_browser_button_ = new FadeButton(this);
|
| + new_browser_button_ = new views::ImageButton(this);
|
| + int new_browser_button_image_id =
|
| + Shell::GetInstance()->delegate()->GetResourceIDForNewBrowserWindow();
|
| new_browser_button_->SetImage(
|
| views::CustomButton::BS_NORMAL,
|
| - rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_CHROME).ToSkBitmap());
|
| + rb.GetImageNamed(new_browser_button_image_id).ToSkBitmap());
|
| ConfigureChildView(new_browser_button_);
|
| AddChildView(new_browser_button_);
|
|
|
| @@ -261,18 +221,29 @@ void LauncherView::Init() {
|
| AddChildView(child);
|
| }
|
|
|
| - show_apps_button_ = new FadeButton(this);
|
| + show_apps_button_ = new views::ImageButton(this);
|
| show_apps_button_->SetImage(
|
| views::CustomButton::BS_NORMAL,
|
| rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToSkBitmap());
|
| + show_apps_button_->SetImage(
|
| + views::CustomButton::BS_HOT,
|
| + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT).ToSkBitmap());
|
| + show_apps_button_->SetImage(
|
| + views::CustomButton::BS_PUSHED,
|
| + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).ToSkBitmap());
|
| ConfigureChildView(show_apps_button_);
|
| AddChildView(show_apps_button_);
|
|
|
| - overflow_button_ = new FadeButton(this);
|
| - // TODO: need image for this.
|
| + overflow_button_ = new views::ImageButton(this);
|
| overflow_button_->SetImage(
|
| views::CustomButton::BS_NORMAL,
|
| rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap());
|
| + overflow_button_->SetImage(
|
| + views::CustomButton::BS_HOT,
|
| + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap());
|
| + overflow_button_->SetImage(
|
| + views::CustomButton::BS_PUSHED,
|
| + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap());
|
| ConfigureChildView(overflow_button_);
|
| AddChildView(overflow_button_);
|
|
|
| @@ -336,8 +307,8 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
|
| (kPreferredHeight - bounds->overflow_bounds.height()) / 2);
|
| x = bounds->overflow_bounds.right() + kHorizontalPadding;
|
| }
|
| - // TODO(sky): -8 is a hack, remove when we get better images.
|
| - bounds->show_apps_bounds.set_x(x - 8);
|
| + // TODO(sky): -6 is a hack, remove when we get better images.
|
| + bounds->show_apps_bounds.set_x(x - 6);
|
| bounds->show_apps_bounds.set_y(
|
| (kPreferredHeight - bounds->show_apps_bounds.height()) / 2);
|
| }
|
|
|