summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-10 20:51:18 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-10 20:51:18 +0000
commitef681d93b2c06bd04c4e126376fc6fab4f37bc03 (patch)
tree3b5c611e4dc117074b4e82ced8cc3c7a988d2333
parentb2908faa9fb9be5a6b1710c81c9dad11e2b48335 (diff)
downloadchromium_src-ef681d93b2c06bd04c4e126376fc6fab4f37bc03.zip
chromium_src-ef681d93b2c06bd04c4e126376fc6fab4f37bc03.tar.gz
chromium_src-ef681d93b2c06bd04c4e126376fc6fab4f37bc03.tar.bz2
Add black border to bottom of launcher so that new resources
have some contrast. Also fix problem w/ HDPI launcher images. BUG=123698 TEST=Visual check Review URL: https://chromiumcodereview.appspot.com/10915149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155822 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/launcher/launcher.cc72
-rw-r--r--ash/launcher/launcher.h5
-rw-r--r--ash/launcher/launcher_view.cc1
-rw-r--r--ash/launcher/tabbed_launcher_button.cc28
-rw-r--r--ash/launcher/tabbed_launcher_button.h12
-rw-r--r--ui/resources/default_100_percent/ash/launcher_browser.pngbin316 -> 1352 bytes
-rw-r--r--ui/resources/default_100_percent/ash/launcher_browser_panel.pngbin338 -> 1362 bytes
-rw-r--r--ui/resources/default_100_percent/ash/launcher_incognito_browser.pngbin984 -> 2148 bytes
-rw-r--r--ui/resources/default_100_percent/ash/launcher_incognito_browser_panel.pngbin959 -> 2111 bytes
-rw-r--r--ui/resources/default_100_percent/ash/launcher_underline_active.pngbin337 -> 1444 bytes
-rw-r--r--ui/resources/default_100_percent/ash/launcher_underline_hover.pngbin337 -> 1465 bytes
-rw-r--r--ui/resources/default_100_percent/ash/launcher_underline_running.pngbin266 -> 1341 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_background.pngbin1092 -> 1083 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_browser.pngbin566 -> 1677 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_browser_panel.pngbin572 -> 1662 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_incognito_browser.pngbin1824 -> 3515 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_incognito_browser_panel.pngbin1807 -> 3485 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_underline_active.pngbin553 -> 1911 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_underline_hover.pngbin544 -> 1914 bytes
-rw-r--r--ui/resources/default_200_percent/ash/launcher_underline_running.pngbin453 -> 1687 bytes
-rw-r--r--ui/resources/ui_resources.grd2
21 files changed, 82 insertions, 38 deletions
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index 20902b9..58db767 100644
--- a/ash/launcher/launcher.cc
+++ b/ash/launcher/launcher.cc
@@ -16,7 +16,9 @@
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/shelf_layout_manager.h"
+#include "grit/ui_resources.h"
#include "ui/aura/window.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
@@ -24,12 +26,18 @@
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
+namespace {
+// Size of black border at bottom (or side) of launcher.
+const int kNumBlackPixels = 3;
+}
+
namespace ash {
// The contents view of the Widget. This view contains LauncherView and
// sizes it to the width of the widget minus the size of the status area.
class Launcher::DelegateView : public views::WidgetDelegate,
- public views::AccessiblePaneView {
+ public views::AccessiblePaneView,
+ public internal::BackgroundAnimatorDelegate {
public:
explicit DelegateView(Launcher* launcher);
virtual ~DelegateView();
@@ -44,6 +52,7 @@ class Launcher::DelegateView : public views::WidgetDelegate,
// views::View overrides
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
+ virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE;
// views::WidgetDelegateView overrides:
virtual views::Widget* GetWidget() OVERRIDE {
@@ -58,16 +67,21 @@ class Launcher::DelegateView : public views::WidgetDelegate,
return focus_cycler_ && focus_cycler_->widget_activating() == GetWidget();
}
+ // BackgroundAnimatorDelegate overrides:
+ virtual void UpdateBackground(int alpha) OVERRIDE;
+
private:
Launcher* launcher_;
internal::FocusCycler* focus_cycler_;
+ int alpha_;
DISALLOW_COPY_AND_ASSIGN(DelegateView);
};
Launcher::DelegateView::DelegateView(Launcher* launcher)
: launcher_(launcher),
- focus_cycler_(NULL) {
+ focus_cycler_(NULL),
+ alpha_(0) {
}
Launcher::DelegateView::~DelegateView() {
@@ -80,32 +94,64 @@ gfx::Size Launcher::DelegateView::GetPreferredSize() {
void Launcher::DelegateView::Layout() {
if (child_count() == 0)
return;
+ View* launcher_view = child_at(0);
+
if (launcher_->alignment_ == SHELF_ALIGNMENT_BOTTOM) {
int w = std::max(0, width() - launcher_->status_size_.width());
- int h = std::min(height(), child_at(0)->GetPreferredSize().height());
+ int h = std::min(height(), launcher_view->GetPreferredSize().height());
int move_up = height() > h ? sqrtf(height() - h) : 0;
- child_at(0)->SetBounds(0, std::max(0, height() - h) - move_up, w, h);
+ launcher_view->SetBounds(0, std::max(0, height() - h) - move_up, w, h);
} else {
int h = std::max(0, height() - launcher_->status_size_.height());
- int w = std::min(width(), child_at(0)->GetPreferredSize().width());
+ int w = std::min(width(), launcher_view->GetPreferredSize().width());
int x = width() > w ? sqrtf(width() - w) : 0;
if (launcher_->alignment_ == SHELF_ALIGNMENT_RIGHT)
x = width() - w - x;
- child_at(0)->SetBounds(x, 0, w, h);
+ launcher_view->SetBounds(x, 0, w, h);
}
}
+void Launcher::DelegateView::OnPaintBackground(gfx::Canvas* canvas) {
+ if (launcher_->alignment_ == SHELF_ALIGNMENT_BOTTOM) {
+ SkPaint paint;
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ static const gfx::ImageSkia* launcher_background = NULL;
+ if (!launcher_background) {
+ launcher_background =
+ rb.GetImageNamed(IDR_AURA_LAUNCHER_BACKGROUND).ToImageSkia();
+ }
+ paint.setAlpha(alpha_);
+ canvas->DrawImageInt(
+ *launcher_background,
+ 0, 0, launcher_background->width(), launcher_background->height(),
+ 0, 0, width(), height(),
+ false,
+ paint);
+ canvas->FillRect(
+ gfx::Rect(0, height() - kNumBlackPixels, width(), kNumBlackPixels),
+ SK_ColorBLACK);
+ } else {
+ // TODO(davemoore): when we get an image for the side launcher background
+ // use it, and handle black border.
+ canvas->DrawColor(SkColorSetARGB(alpha_, 0, 0, 0));
+ }
+}
+
+void Launcher::DelegateView::UpdateBackground(int alpha) {
+ alpha_ = alpha;
+ SchedulePaint();
+}
+
// Launcher --------------------------------------------------------------------
Launcher::Launcher(aura::Window* window_container,
internal::ShelfLayoutManager* shelf_layout_manager)
: widget_(NULL),
window_container_(window_container),
- delegate_view_(NULL),
+ delegate_view_(new DelegateView(this)),
launcher_view_(NULL),
alignment_(SHELF_ALIGNMENT_BOTTOM),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- background_animator_(this, 0, kLauncherBackgroundAlpha)) {
+ background_animator_(delegate_view_, 0, kLauncherBackgroundAlpha) {
model_.reset(new LauncherModel);
if (Shell::GetInstance()->delegate()) {
delegate_.reset(
@@ -115,8 +161,6 @@ Launcher::Launcher(aura::Window* window_container,
widget_.reset(new views::Widget);
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- // The launcher only ever draws a solid color.
- params.layer_type = ui::LAYER_SOLID_COLOR;
params.transparent = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = Shell::GetContainer(
@@ -125,7 +169,6 @@ Launcher::Launcher(aura::Window* window_container,
launcher_view_ = new internal::LauncherView(
model_.get(), delegate_.get(), shelf_layout_manager);
launcher_view_->Init();
- delegate_view_ = new DelegateView(this);
delegate_view_->AddChildView(launcher_view_);
params.delegate = delegate_view_;
widget_->Init(params);
@@ -228,9 +271,4 @@ internal::LauncherView* Launcher::GetLauncherViewForTest() {
return launcher_view_;
}
-void Launcher::UpdateBackground(int alpha) {
- ui::Layer* layer = widget_->GetNativeView()->layer();
- layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0));
-}
-
} // namespace ash
diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h
index eb35297..d889e61 100644
--- a/ash/launcher/launcher.h
+++ b/ash/launcher/launcher.h
@@ -38,7 +38,7 @@ class LauncherIconObserver;
class LauncherDelegate;
class LauncherModel;
-class ASH_EXPORT Launcher : public internal::BackgroundAnimatorDelegate {
+class ASH_EXPORT Launcher {
public:
Launcher(aura::Window* window_container,
internal::ShelfLayoutManager* shelf_layout_manager);
@@ -98,9 +98,6 @@ class ASH_EXPORT Launcher : public internal::BackgroundAnimatorDelegate {
aura::Window* window_container() { return window_container_; }
- // BackgroundAnimatorDelegate overrides:
- virtual void UpdateBackground(int alpha) OVERRIDE;
-
private:
class DelegateView;
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 53b65f4..17eb877 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -26,6 +26,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
+#include "ui/gfx/canvas.h"
#include "ui/views/animation/bounds_animator.h"
#include "ui/views/border.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
diff --git a/ash/launcher/tabbed_launcher_button.cc b/ash/launcher/tabbed_launcher_button.cc
index 7add7cf..5e6ab7d 100644
--- a/ash/launcher/tabbed_launcher_button.cc
+++ b/ash/launcher/tabbed_launcher_button.cc
@@ -25,15 +25,14 @@ TabbedLauncherButton::IconView::IconView(
if (!browser_image_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- browser_image_ = new SkBitmap(
- *rb.GetImageNamed(IDR_AURA_LAUNCHER_BROWSER).ToSkBitmap());
- incognito_browser_image_ = new SkBitmap(
- *rb.GetImageNamed(IDR_AURA_LAUNCHER_INCOGNITO_BROWSER).ToSkBitmap());
- browser_panel_image_ = new SkBitmap(
- *rb.GetImageNamed(IDR_AURA_LAUNCHER_BROWSER_PANEL).ToSkBitmap());
- incognito_browser_panel_image_ = new SkBitmap(
- *rb.GetImageNamed(
- IDR_AURA_LAUNCHER_INCOGNITO_BROWSER_PANEL).ToSkBitmap());
+ browser_image_ = rb.GetImageNamed(IDR_AURA_LAUNCHER_BROWSER).ToImageSkia();
+ incognito_browser_image_ =
+ rb.GetImageNamed(IDR_AURA_LAUNCHER_INCOGNITO_BROWSER).ToImageSkia();
+ browser_panel_image_ =
+ rb.GetImageNamed(IDR_AURA_LAUNCHER_BROWSER_PANEL).ToImageSkia();
+ incognito_browser_panel_image_ =
+ rb.GetImageNamed(
+ IDR_AURA_LAUNCHER_INCOGNITO_BROWSER_PANEL).ToImageSkia();
}
set_icon_size(0);
if (host->is_incognito() == STATE_NOT_INCOGNITO)
@@ -101,10 +100,13 @@ void TabbedLauncherButton::IconView::OnPaint(gfx::Canvas* canvas) {
}
// static
-SkBitmap* TabbedLauncherButton::IconView::browser_image_ = NULL;
-SkBitmap* TabbedLauncherButton::IconView::incognito_browser_image_ = NULL;
-SkBitmap* TabbedLauncherButton::IconView::browser_panel_image_ = NULL;
-SkBitmap* TabbedLauncherButton::IconView::incognito_browser_panel_image_ = NULL;
+const gfx::ImageSkia* TabbedLauncherButton::IconView::browser_image_ = NULL;
+const gfx::ImageSkia* TabbedLauncherButton::IconView::incognito_browser_image_ =
+ NULL;
+const gfx::ImageSkia* TabbedLauncherButton::IconView::browser_panel_image_ =
+ NULL;
+const gfx::ImageSkia*
+ TabbedLauncherButton::IconView::incognito_browser_panel_image_ = NULL;
TabbedLauncherButton* TabbedLauncherButton::Create(
views::ButtonListener* listener,
diff --git a/ash/launcher/tabbed_launcher_button.h b/ash/launcher/tabbed_launcher_button.h
index 2cc864d..f78ec07 100644
--- a/ash/launcher/tabbed_launcher_button.h
+++ b/ash/launcher/tabbed_launcher_button.h
@@ -12,6 +12,10 @@
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/glow_hover_controller.h"
+namespace gfx {
+class ImageSkia;
+}
+
namespace ui {
class MultiAnimation;
}
@@ -80,11 +84,11 @@ class TabbedLauncherButton : public LauncherButton {
scoped_ptr<ui::MultiAnimation> animation_;
// Background images. Which one is chosen depends on the type of the window.
- static SkBitmap* browser_image_;
- static SkBitmap* incognito_browser_image_;
+ static const gfx::ImageSkia* browser_image_;
+ static const gfx::ImageSkia* incognito_browser_image_;
// TODO[dave] implement panel specific image.
- static SkBitmap* browser_panel_image_;
- static SkBitmap* incognito_browser_panel_image_;
+ static const gfx::ImageSkia* browser_panel_image_;
+ static const gfx::ImageSkia* incognito_browser_panel_image_;
DISALLOW_COPY_AND_ASSIGN(IconView);
};
diff --git a/ui/resources/default_100_percent/ash/launcher_browser.png b/ui/resources/default_100_percent/ash/launcher_browser.png
index f6a14e5..00b7c53 100644
--- a/ui/resources/default_100_percent/ash/launcher_browser.png
+++ b/ui/resources/default_100_percent/ash/launcher_browser.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/launcher_browser_panel.png b/ui/resources/default_100_percent/ash/launcher_browser_panel.png
index f9cb70f..9d2d91c 100644
--- a/ui/resources/default_100_percent/ash/launcher_browser_panel.png
+++ b/ui/resources/default_100_percent/ash/launcher_browser_panel.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/launcher_incognito_browser.png b/ui/resources/default_100_percent/ash/launcher_incognito_browser.png
index acec0d3..a4fbb29 100644
--- a/ui/resources/default_100_percent/ash/launcher_incognito_browser.png
+++ b/ui/resources/default_100_percent/ash/launcher_incognito_browser.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/launcher_incognito_browser_panel.png b/ui/resources/default_100_percent/ash/launcher_incognito_browser_panel.png
index fab5ef0..112ea8b 100644
--- a/ui/resources/default_100_percent/ash/launcher_incognito_browser_panel.png
+++ b/ui/resources/default_100_percent/ash/launcher_incognito_browser_panel.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/launcher_underline_active.png b/ui/resources/default_100_percent/ash/launcher_underline_active.png
index 67044fd..5b9c467 100644
--- a/ui/resources/default_100_percent/ash/launcher_underline_active.png
+++ b/ui/resources/default_100_percent/ash/launcher_underline_active.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/launcher_underline_hover.png b/ui/resources/default_100_percent/ash/launcher_underline_hover.png
index b7cf40a..dd7be77 100644
--- a/ui/resources/default_100_percent/ash/launcher_underline_hover.png
+++ b/ui/resources/default_100_percent/ash/launcher_underline_hover.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/launcher_underline_running.png b/ui/resources/default_100_percent/ash/launcher_underline_running.png
index faf1a9c..92ab244 100644
--- a/ui/resources/default_100_percent/ash/launcher_underline_running.png
+++ b/ui/resources/default_100_percent/ash/launcher_underline_running.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_background.png b/ui/resources/default_200_percent/ash/launcher_background.png
index 902dead..02d8a2d 100644
--- a/ui/resources/default_200_percent/ash/launcher_background.png
+++ b/ui/resources/default_200_percent/ash/launcher_background.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_browser.png b/ui/resources/default_200_percent/ash/launcher_browser.png
index 99367be..1a62e18 100644
--- a/ui/resources/default_200_percent/ash/launcher_browser.png
+++ b/ui/resources/default_200_percent/ash/launcher_browser.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_browser_panel.png b/ui/resources/default_200_percent/ash/launcher_browser_panel.png
index 37b9b01..76af76b 100644
--- a/ui/resources/default_200_percent/ash/launcher_browser_panel.png
+++ b/ui/resources/default_200_percent/ash/launcher_browser_panel.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_incognito_browser.png b/ui/resources/default_200_percent/ash/launcher_incognito_browser.png
index 3c0ef9f..a8ade13 100644
--- a/ui/resources/default_200_percent/ash/launcher_incognito_browser.png
+++ b/ui/resources/default_200_percent/ash/launcher_incognito_browser.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_incognito_browser_panel.png b/ui/resources/default_200_percent/ash/launcher_incognito_browser_panel.png
index 8213a8a..eb33138 100644
--- a/ui/resources/default_200_percent/ash/launcher_incognito_browser_panel.png
+++ b/ui/resources/default_200_percent/ash/launcher_incognito_browser_panel.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_underline_active.png b/ui/resources/default_200_percent/ash/launcher_underline_active.png
index 1beb98a..1b5c58a 100644
--- a/ui/resources/default_200_percent/ash/launcher_underline_active.png
+++ b/ui/resources/default_200_percent/ash/launcher_underline_active.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_underline_hover.png b/ui/resources/default_200_percent/ash/launcher_underline_hover.png
index b1cdbaf..a464a8e 100644
--- a/ui/resources/default_200_percent/ash/launcher_underline_hover.png
+++ b/ui/resources/default_200_percent/ash/launcher_underline_hover.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/launcher_underline_running.png b/ui/resources/default_200_percent/ash/launcher_underline_running.png
index 1e48077..fd1fe0f 100644
--- a/ui/resources/default_200_percent/ash/launcher_underline_running.png
+++ b/ui/resources/default_200_percent/ash/launcher_underline_running.png
Binary files differ
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd
index 6bee3b0..33ed398 100644
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -57,9 +57,11 @@
<structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_ZOOM_OUT" file="cros/pointers/zoom_out.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_GRAB" file="cros/pointers/fleur.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_CURSOR_GRABBING" file="cros/pointers/hand3.png" />
+ <structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_BACKGROUND" file="ash/launcher_background.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_BROWSER" file="ash/launcher_browser.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_BROWSER_PANEL" file="ash/launcher_browser_panel.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_BROWSER_SHORTCUT" file="aura/chromium-32.png" />
+ <structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_DIMMING" file="ash/launcher_dimming.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_ICON_APPLIST" file="ash/launcher_applist.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_ICON_APPLIST_HOT" file="ash/launcher_applist_hover.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED" file="ash/launcher_applist_pressed.png" />