summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 03:12:11 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 03:12:11 +0000
commit87b51d821fc260fc77eae985fb37998be8c836d3 (patch)
treee6e00232c0941d134174c68194324ce78a7ec4f3
parent0e77a1d0e67c41eaa07411b0d6958042c652476a (diff)
downloadchromium_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
-rw-r--r--ash/launcher/launcher_button.cc43
-rw-r--r--ash/launcher/launcher_button.h2
-rw-r--r--ash/launcher/launcher_view.cc2
-rw-r--r--chrome/browser/ui/views/ash/launcher/launcher_updater.cc6
-rw-r--r--ui/resources/ui_resources.grd3
5 files changed, 35 insertions, 21 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 {
diff --git a/chrome/browser/ui/views/ash/launcher/launcher_updater.cc b/chrome/browser/ui/views/ash/launcher/launcher_updater.cc
index 4df4c93..b21e5ee 100644
--- a/chrome/browser/ui/views/ash/launcher/launcher_updater.cc
+++ b/chrome/browser/ui/views/ash/launcher/launcher_updater.cc
@@ -155,7 +155,8 @@ void LauncherUpdater::TabChangedAt(
return;
}
- if (tab->favicon_tab_helper()->FaviconIsValid()) {
+ if (tab->favicon_tab_helper()->FaviconIsValid() ||
+ !tab->favicon_tab_helper()->ShouldDisplayFavicon()) {
// We have the favicon, update immediately.
UpdateLauncher(tab);
} else {
@@ -257,6 +258,9 @@ void LauncherUpdater::UpdateLauncher(TabContentsWrapper* tab) {
item.image = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_DEFAULT_FAVICON);
}
+ } else {
+ item.image = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_DEFAULT_FAVICON);
}
}
launcher_model()->Set(item_index, item);
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd
index a044cd0..10896a9 100644
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -128,6 +128,9 @@
<include name="IDR_AURA_LAUNCHER_OVERFLOW" file="aura/launcher_overflow.png" type="BINDATA" />
<include name="IDR_AURA_LAUNCHER_OVERFLOW_HOT" file="aura/launcher_overflow_h.png" type="BINDATA" />
<include name="IDR_AURA_LAUNCHER_OVERFLOW_PUSHED" file="aura/launcher_overflow_p.png" type="BINDATA" />
+ <include name="IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE" file="aura/launcher_underline_active.png" type="BINDATA" />
+ <include name="IDR_AURA_LAUNCHER_UNDERLINE_HOVER" file="aura/launcher_underline_hover.png" type="BINDATA" />
+ <include name="IDR_AURA_LAUNCHER_UNDERLINE_RUNNING" file="aura/launcher_underline_running.png" type="BINDATA" />
<include name="IDR_AURA_MULTI_WINDOW_RESIZE_H" file="aura/multi_window_resize_h.png" type="BINDATA" />
<include name="IDR_AURA_MULTI_WINDOW_RESIZE_V" file="aura/multi_window_resize_v.png" type="BINDATA" />
<include name="IDR_AURA_RESIZE_SHADOW_TOP_LEFT" file="aura/resize_shadow_top_left.png" type="BINDATA" />