summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/status
diff options
context:
space:
mode:
authorchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 22:25:05 +0000
committerchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 22:25:05 +0000
commitfe41d72fbd2f2cb9f087d35065c35bbdc376b2c4 (patch)
treed3598f89416ce330dfc8707b89b81164a046dbfc /chrome/browser/chromeos/status
parentd8a5ab0212d7874ad4496487f0ef3f97ada6e5df (diff)
downloadchromium_src-fe41d72fbd2f2cb9f087d35065c35bbdc376b2c4.zip
chromium_src-fe41d72fbd2f2cb9f087d35065c35bbdc376b2c4.tar.gz
chromium_src-fe41d72fbd2f2cb9f087d35065c35bbdc376b2c4.tar.bz2
New status bar images for ChromeOS.
Added icons to network options page. TEST=none BUG=none Review URL: http://codereview.chromium.org/657001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/status')
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc25
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.h19
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.cc11
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.h4
-rw-r--r--chrome/browser/chromeos/status/status_area_button.cc3
-rw-r--r--chrome/browser/chromeos/status/status_area_button.h5
6 files changed, 50 insertions, 17 deletions
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index 8ed86c9..4b498d7 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -69,10 +69,7 @@ bool NetworkMenuButton::IsItemCheckedAt(int index) const {
bool NetworkMenuButton::GetIconAt(int index, SkBitmap* icon) const {
if (!menu_items_[index].icon.empty()) {
- // Make icon smaller (if necessary) to look better in the menu.
- static const int kMinSize = 8;
- *icon = SkBitmapOperations::DownsampleByTwoUntilSize(
- menu_items_[index].icon, kMinSize, kMinSize);
+ *icon = menu_items_[index].icon;
return true;
}
return false;
@@ -166,6 +163,22 @@ void NetworkMenuButton::AnimationProgressed(const Animation* animation) {
////////////////////////////////////////////////////////////////////////////////
// NetworkMenuButton, StatusAreaButton implementation:
+void NetworkMenuButton::DrawPressed(gfx::Canvas* canvas) {
+ // If ethernet connected and not current connecting, then show ethernet
+ // pressed icon. Otherwise, show the bars pressed icon.
+ if (NetworkLibrary::Get()->ethernet_connected() &&
+ !animation_connecting_.IsAnimating())
+ canvas->DrawBitmapInt(IconForDisplay(
+ *ResourceBundle::GetSharedInstance().
+ GetBitmapNamed(IDR_STATUSBAR_NETWORK_WIRED_PRESSED), SkBitmap()),
+ 0, 0);
+ else
+ canvas->DrawBitmapInt(IconForDisplay(
+ *ResourceBundle::GetSharedInstance().
+ GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS_PRESSED), SkBitmap()),
+ 0, 0);
+}
+
void NetworkMenuButton::DrawIcon(gfx::Canvas* canvas) {
canvas->DrawBitmapInt(IconForDisplay(icon(), badge()), 0, 0);
}
@@ -394,10 +407,12 @@ void NetworkMenuButton::InitMenuItems() {
for (size_t i = 0; i < wifi_networks.size(); ++i) {
label = ASCIIToUTF16(wifi_networks[i].ssid);
SkBitmap icon = IconForNetworkStrength(wifi_networks[i].strength, true);
+ SkBitmap badge = wifi_networks[i].encrypted ?
+ *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE) : SkBitmap();
flag = (wifi_networks[i].ssid == cros->wifi_ssid()) ?
FLAG_WIFI | FLAG_ASSOCIATED : FLAG_WIFI;
menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
- IconForDisplay(icon, SkBitmap()), wifi_networks[i], CellularNetwork(),
+ IconForDisplay(icon, badge), wifi_networks[i], CellularNetwork(),
flag));
}
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
index c206818..e16e677 100644
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ b/chrome/browser/chromeos/status/network_menu_button.h
@@ -93,12 +93,22 @@ class NetworkMenuButton : public StatusAreaButton,
virtual void NetworkChanged(NetworkLibrary* obj);
virtual void NetworkTraffic(NetworkLibrary* cros, int traffic_type);
+ // Returns the Icon for a network strength between 0 and 100.
+ // |black| is used to specify whether to return a black icon for display
+ // on a light background or a white icon for display on a dark background.
+ static SkBitmap IconForNetworkStrength(int strength, bool black);
+
+ // This method will convert the |icon| bitmap to the correct size for display.
+ // If the |badge| icon is not empty, it will draw that on top of the icon.
+ static SkBitmap IconForDisplay(SkBitmap icon, SkBitmap badge);
+
// Sets the badge icon.
void SetBadge(const SkBitmap& badge);
SkBitmap badge() const { return badge_; }
protected:
// StatusAreaButton implementation.
+ virtual void DrawPressed(gfx::Canvas* canvas);
virtual void DrawIcon(gfx::Canvas* canvas);
private:
@@ -138,15 +148,6 @@ class NetworkMenuButton : public StatusAreaButton,
};
typedef std::vector<MenuItem> MenuItemVector;
- // Returns the Icon for a network strength between 0 and 100.
- // |black| is used to specify whether to return a black icon for display
- // on a light background or a white icon for display on a dark background.
- static SkBitmap IconForNetworkStrength(int strength, bool black);
-
- // This method will convert the |icon| bitmap to the correct size for display.
- // If the |badge| icon is not empty, it will draw that on top of the icon.
- static SkBitmap IconForDisplay(SkBitmap icon, SkBitmap badge);
-
// views::ViewMenuDelegate implementation.
virtual void RunMenu(views::View* source, const gfx::Point& pt);
diff --git a/chrome/browser/chromeos/status/power_menu_button.cc b/chrome/browser/chromeos/status/power_menu_button.cc
index b0345ee..b277654 100644
--- a/chrome/browser/chromeos/status/power_menu_button.cc
+++ b/chrome/browser/chromeos/status/power_menu_button.cc
@@ -103,12 +103,21 @@ void PowerMenuButton::PowerChanged(PowerLibrary* obj) {
////////////////////////////////////////////////////////////////////////////////
// PowerMenuButton, StatusAreaButton implementation:
+void PowerMenuButton::DrawPressed(gfx::Canvas* canvas) {
+ DrawPowerIcon(canvas, *ResourceBundle::GetSharedInstance().
+ GetBitmapNamed(IDR_STATUSBAR_BATTERY_PRESSED));
+}
+
void PowerMenuButton::DrawIcon(gfx::Canvas* canvas) {
+ DrawPowerIcon(canvas, icon());
+}
+
+void PowerMenuButton::DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon) {
// Draw the battery icon 6 pixels down to center it.
// Because the status icon is 24x24 but the images are 24x16.
// But since the images are shifted up by 4 pixels, we draw at 6 pixels down.
static const int kIconVerticalPadding = 6;
- canvas->DrawBitmapInt(icon(), 0, kIconVerticalPadding);
+ canvas->DrawBitmapInt(icon, 0, kIconVerticalPadding);
}
void PowerMenuButton::UpdateIcon() {
diff --git a/chrome/browser/chromeos/status/power_menu_button.h b/chrome/browser/chromeos/status/power_menu_button.h
index 1828f1f..0a0c98d 100644
--- a/chrome/browser/chromeos/status/power_menu_button.h
+++ b/chrome/browser/chromeos/status/power_menu_button.h
@@ -48,12 +48,16 @@ class PowerMenuButton : public StatusAreaButton,
protected:
// StatusAreaButton implementation.
+ virtual void DrawPressed(gfx::Canvas* canvas);
virtual void DrawIcon(gfx::Canvas* canvas);
private:
// views::ViewMenuDelegate implementation.
virtual void RunMenu(views::View* source, const gfx::Point& pt);
+ // This method will draw the |icon| in the appropriate place on the |canvas|.
+ void DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon);
+
// Update the power icon depending on the power status.
void UpdateIcon();
diff --git a/chrome/browser/chromeos/status/status_area_button.cc b/chrome/browser/chromeos/status/status_area_button.cc
index d779eea..8a695b1 100644
--- a/chrome/browser/chromeos/status/status_area_button.cc
+++ b/chrome/browser/chromeos/status/status_area_button.cc
@@ -24,8 +24,7 @@ StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate)
void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) {
if (state() == BS_PUSHED) {
- canvas->DrawBitmapInt(*ResourceBundle::GetSharedInstance().
- GetBitmapNamed(IDR_STATUSBAR_PRESSED), 0, 0);
+ DrawPressed(canvas);
}
DrawIcon(canvas);
}
diff --git a/chrome/browser/chromeos/status/status_area_button.h b/chrome/browser/chromeos/status/status_area_button.h
index cb7728d..b751653 100644
--- a/chrome/browser/chromeos/status/status_area_button.h
+++ b/chrome/browser/chromeos/status/status_area_button.h
@@ -20,6 +20,11 @@ class StatusAreaButton : public views::MenuButton {
virtual gfx::Size GetPreferredSize();
protected:
+ // Draws the pressed icon. This is called before DrawIcon if the state is
+ // pressed. Subclasses should override this method if they need to draw a
+ // pressed icon.
+ virtual void DrawPressed(gfx::Canvas* canvas) {}
+
// Draws the icon for this status area button on the canvas.
// Subclasses should override this method if they need to draw their own icon.
// Otherwise, just call SetIcon() and the it will be handled for you.