diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 03:12:11 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 03:12:11 +0000 |
commit | 87b51d821fc260fc77eae985fb37998be8c836d3 (patch) | |
tree | e6e00232c0941d134174c68194324ce78a7ec4f3 /ash/launcher | |
parent | 0e77a1d0e67c41eaa07411b0d6958042c652476a (diff) | |
download | chromium_src-87b51d821fc260fc77eae985fb37998be8c836d3.zip chromium_src-87b51d821fc260fc77eae985fb37998be8c836d3.tar.gz chromium_src-87b51d821fc260fc77eae985fb37998be8c836d3.tar.bz2 |
- Set default favicon for pages w/out one
- Change layout a little
- Use image for underbars to allow easier replacement / styling
BUG=118828
TEST=None
Review URL: https://chromiumcodereview.appspot.com/9732034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher')
-rw-r--r-- | ash/launcher/launcher_button.cc | 43 | ||||
-rw-r--r-- | ash/launcher/launcher_button.h | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_view.cc | 2 |
3 files changed, 27 insertions, 20 deletions
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc index e5ee4be..fa14b74 100644 --- a/ash/launcher/launcher_button.cc +++ b/ash/launcher/launcher_button.cc @@ -7,10 +7,13 @@ #include <algorithm> #include "ash/launcher/launcher_button_host.h" +#include "grit/ui_resources.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "ui/gfx/compositor/layer.h" #include "ui/gfx/compositor/scoped_layer_animation_settings.h" +#include "ui/gfx/image/image.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/views/controls/image_view.h" namespace { @@ -21,11 +24,11 @@ const int kIconWidth = 48; const int kHopSpacing = 2; const int kActiveBarColor = 0xe6ffffff; const int kInactiveBarColor = 0x80ffffff; -const int kHopUpMS = 130; -const int kHopDownMS = 260; +const int kHopUpMS = 200; +const int kHopDownMS = 200; // Used to allow Mouse...() messages to go to the parent view. -class MouseIgnoredView : public views::View { +class MouseIgnoredImageView : public views::ImageView { public: bool HitTest(const gfx::Point& l) const OVERRIDE { return false; @@ -65,14 +68,15 @@ LauncherButton::LauncherButton(views::ButtonListener* listener, : CustomButton(listener), host_(host), icon_view_(NULL), - bar_(new MouseIgnoredView), + bar_(new MouseIgnoredImageView), state_(STATE_NORMAL) { set_accessibility_focusable(true); + bar_->SetHorizontalAlignment(views::ImageView::CENTER); + bar_->SetVerticalAlignment(views::ImageView::TRAILING); + AddChildView(bar_); } LauncherButton::~LauncherButton() { - if (!bar_->parent()) - delete bar_; } void LauncherButton::SetImage(const SkBitmap& image) { @@ -129,6 +133,7 @@ void LauncherButton::ClearState(State state) { if (!ShouldHop(state) || ShouldHop(state_)) { ui::ScopedLayerAnimationSettings scoped_setter( icon_view_->layer()->GetAnimator()); + scoped_setter.SetTweenType(ui::Tween::LINEAR); scoped_setter.SetTransitionDuration( base::TimeDelta::FromMilliseconds(kHopDownMS)); state_ &= ~state; @@ -192,7 +197,7 @@ void LauncherButton::Layout() { image_y -= kHopSpacing; icon_view_->SetPosition(gfx::Point(image_x, image_y)); - bar_->SetBounds(0, height() - kBarHeight, width(), kBarHeight); + bar_->SetBounds(0, 0, width(), height()); } bool LauncherButton::GetTooltipText( @@ -219,18 +224,20 @@ LauncherButton::IconView* LauncherButton::CreateIconView() { void LauncherButton::UpdateState() { if (state_ == STATE_NORMAL) { - if (bar_->parent()) - RemoveChildView(bar_); + bar_->SetVisible(false); } else { - if (!bar_->parent()) - AddChildView(bar_); - if (state_ & STATE_HOVERED || state_ & STATE_ACTIVE) { - bar_->set_background(views::Background::CreateSolidBackground( - kActiveBarColor)); - } else if (state_ & STATE_RUNNING) { - bar_->set_background(views::Background::CreateSolidBackground( - kInactiveBarColor)); - } + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + int bar_id; + bar_->SetVisible(true); + + if (state_ & STATE_HOVERED) + bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER; + else if (state_ & STATE_ACTIVE) + bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE; + else + bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; + + bar_->SetImage(rb.GetImageNamed(bar_id).ToSkBitmap()); } Layout(); diff --git a/ash/launcher/launcher_button.h b/ash/launcher/launcher_button.h index 6ffbd1d..21f9030 100644 --- a/ash/launcher/launcher_button.h +++ b/ash/launcher/launcher_button.h @@ -91,7 +91,7 @@ class LauncherButton : public views::CustomButton { LauncherButtonHost* host_; IconView* icon_view_; // Draws a bar underneath the image to represent the state of the application. - views::View* bar_; + views::ImageView* bar_; // The current state of the application, multiple values of AppState are or'd // together. int state_; diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index b475710..62b9852 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -46,7 +46,7 @@ static const int kMinimumDragDistance = 8; // Size given to the buttons on the launcher. static const int kButtonWidth = 48; static const int kButtonHeight = 48; -static const int kButtonSpacing = 8; +static const int kButtonSpacing = 4; namespace { |