diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 16:13:58 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 16:13:58 +0000 |
commit | 1a63bcd23d4f4545abf0f2ec13031da0bf0c1fb1 (patch) | |
tree | 214632937651215059373bc631487b90fd1f653e | |
parent | 168942a72bf356a60bed79ec316127abcba3daa6 (diff) | |
download | chromium_src-1a63bcd23d4f4545abf0f2ec13031da0bf0c1fb1.zip chromium_src-1a63bcd23d4f4545abf0f2ec13031da0bf0c1fb1.tar.gz chromium_src-1a63bcd23d4f4545abf0f2ec13031da0bf0c1fb1.tar.bz2 |
New button scheme...borders are separate from the inner contents so
that they can be highlighted / depressed independently.
Got alignment of buttons right.
Support hover and pushed in StatusAreaButton.
Share status area button code.
New icons for battery and wifi.
New images.
Review URL: http://codereview.chromium.org/300018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29651 0039d316-1c4b-4281-b951-d872f2087c98
68 files changed, 142 insertions, 47 deletions
diff --git a/chrome/app/theme/statusbar_battery10c.png b/chrome/app/theme/statusbar_battery10c.png Binary files differnew file mode 100644 index 0000000..5150982 --- /dev/null +++ b/chrome/app/theme/statusbar_battery10c.png diff --git a/chrome/app/theme/statusbar_battery10d.png b/chrome/app/theme/statusbar_battery10d.png Binary files differnew file mode 100644 index 0000000..4915275 --- /dev/null +++ b/chrome/app/theme/statusbar_battery10d.png diff --git a/chrome/app/theme/statusbar_battery11c.png b/chrome/app/theme/statusbar_battery11c.png Binary files differnew file mode 100644 index 0000000..7063619 --- /dev/null +++ b/chrome/app/theme/statusbar_battery11c.png diff --git a/chrome/app/theme/statusbar_battery11d.png b/chrome/app/theme/statusbar_battery11d.png Binary files differnew file mode 100644 index 0000000..8dc2eb3 --- /dev/null +++ b/chrome/app/theme/statusbar_battery11d.png diff --git a/chrome/app/theme/statusbar_battery12c.png b/chrome/app/theme/statusbar_battery12c.png Binary files differnew file mode 100644 index 0000000..85069aa --- /dev/null +++ b/chrome/app/theme/statusbar_battery12c.png diff --git a/chrome/app/theme/statusbar_battery12d.png b/chrome/app/theme/statusbar_battery12d.png Binary files differnew file mode 100644 index 0000000..ce130db --- /dev/null +++ b/chrome/app/theme/statusbar_battery12d.png diff --git a/chrome/app/theme/statusbar_battery13c.png b/chrome/app/theme/statusbar_battery13c.png Binary files differnew file mode 100644 index 0000000..08cc139 --- /dev/null +++ b/chrome/app/theme/statusbar_battery13c.png diff --git a/chrome/app/theme/statusbar_battery13d.png b/chrome/app/theme/statusbar_battery13d.png Binary files differnew file mode 100644 index 0000000..c63dda7 --- /dev/null +++ b/chrome/app/theme/statusbar_battery13d.png diff --git a/chrome/app/theme/statusbar_battery14c.png b/chrome/app/theme/statusbar_battery14c.png Binary files differnew file mode 100644 index 0000000..0874a9e --- /dev/null +++ b/chrome/app/theme/statusbar_battery14c.png diff --git a/chrome/app/theme/statusbar_battery14d.png b/chrome/app/theme/statusbar_battery14d.png Binary files differnew file mode 100644 index 0000000..9620a68 --- /dev/null +++ b/chrome/app/theme/statusbar_battery14d.png diff --git a/chrome/app/theme/statusbar_battery15c.png b/chrome/app/theme/statusbar_battery15c.png Binary files differnew file mode 100644 index 0000000..4ab3e48 --- /dev/null +++ b/chrome/app/theme/statusbar_battery15c.png diff --git a/chrome/app/theme/statusbar_battery15d.png b/chrome/app/theme/statusbar_battery15d.png Binary files differnew file mode 100644 index 0000000..d377e6d --- /dev/null +++ b/chrome/app/theme/statusbar_battery15d.png diff --git a/chrome/app/theme/statusbar_battery16c.png b/chrome/app/theme/statusbar_battery16c.png Binary files differnew file mode 100644 index 0000000..ec1c311 --- /dev/null +++ b/chrome/app/theme/statusbar_battery16c.png diff --git a/chrome/app/theme/statusbar_battery16d.png b/chrome/app/theme/statusbar_battery16d.png Binary files differnew file mode 100644 index 0000000..345c528 --- /dev/null +++ b/chrome/app/theme/statusbar_battery16d.png diff --git a/chrome/app/theme/statusbar_battery1c.png b/chrome/app/theme/statusbar_battery1c.png Binary files differindex d812f0b..ed662bf 100644 --- a/chrome/app/theme/statusbar_battery1c.png +++ b/chrome/app/theme/statusbar_battery1c.png diff --git a/chrome/app/theme/statusbar_battery1d.png b/chrome/app/theme/statusbar_battery1d.png Binary files differindex b28b2b7..061791c 100644 --- a/chrome/app/theme/statusbar_battery1d.png +++ b/chrome/app/theme/statusbar_battery1d.png diff --git a/chrome/app/theme/statusbar_battery2c.png b/chrome/app/theme/statusbar_battery2c.png Binary files differindex a5c1a5b..ac185bc 100644 --- a/chrome/app/theme/statusbar_battery2c.png +++ b/chrome/app/theme/statusbar_battery2c.png diff --git a/chrome/app/theme/statusbar_battery2d.png b/chrome/app/theme/statusbar_battery2d.png Binary files differindex 6256707..e0a0695 100644 --- a/chrome/app/theme/statusbar_battery2d.png +++ b/chrome/app/theme/statusbar_battery2d.png diff --git a/chrome/app/theme/statusbar_battery3c.png b/chrome/app/theme/statusbar_battery3c.png Binary files differindex 42886ed..a03f57e 100644 --- a/chrome/app/theme/statusbar_battery3c.png +++ b/chrome/app/theme/statusbar_battery3c.png diff --git a/chrome/app/theme/statusbar_battery3d.png b/chrome/app/theme/statusbar_battery3d.png Binary files differindex 4657493..5a2dc11 100644 --- a/chrome/app/theme/statusbar_battery3d.png +++ b/chrome/app/theme/statusbar_battery3d.png diff --git a/chrome/app/theme/statusbar_battery4c.png b/chrome/app/theme/statusbar_battery4c.png Binary files differindex 1f90b72..a20ddbb 100644 --- a/chrome/app/theme/statusbar_battery4c.png +++ b/chrome/app/theme/statusbar_battery4c.png diff --git a/chrome/app/theme/statusbar_battery4d.png b/chrome/app/theme/statusbar_battery4d.png Binary files differindex d78b44d..9cadf16 100644 --- a/chrome/app/theme/statusbar_battery4d.png +++ b/chrome/app/theme/statusbar_battery4d.png diff --git a/chrome/app/theme/statusbar_battery5c.png b/chrome/app/theme/statusbar_battery5c.png Binary files differindex 5eb5aa8..01946a5 100644 --- a/chrome/app/theme/statusbar_battery5c.png +++ b/chrome/app/theme/statusbar_battery5c.png diff --git a/chrome/app/theme/statusbar_battery5d.png b/chrome/app/theme/statusbar_battery5d.png Binary files differindex 91b0ae7..6ddda93 100644 --- a/chrome/app/theme/statusbar_battery5d.png +++ b/chrome/app/theme/statusbar_battery5d.png diff --git a/chrome/app/theme/statusbar_battery6c.png b/chrome/app/theme/statusbar_battery6c.png Binary files differindex 922cda8..93c05d6 100644 --- a/chrome/app/theme/statusbar_battery6c.png +++ b/chrome/app/theme/statusbar_battery6c.png diff --git a/chrome/app/theme/statusbar_battery6d.png b/chrome/app/theme/statusbar_battery6d.png Binary files differindex 83e3f1a..015a270 100644 --- a/chrome/app/theme/statusbar_battery6d.png +++ b/chrome/app/theme/statusbar_battery6d.png diff --git a/chrome/app/theme/statusbar_battery7c.png b/chrome/app/theme/statusbar_battery7c.png Binary files differindex 23202cd..d9d5c6c 100644 --- a/chrome/app/theme/statusbar_battery7c.png +++ b/chrome/app/theme/statusbar_battery7c.png diff --git a/chrome/app/theme/statusbar_battery7d.png b/chrome/app/theme/statusbar_battery7d.png Binary files differindex b778cb9..ee65b33 100644 --- a/chrome/app/theme/statusbar_battery7d.png +++ b/chrome/app/theme/statusbar_battery7d.png diff --git a/chrome/app/theme/statusbar_battery8c.png b/chrome/app/theme/statusbar_battery8c.png Binary files differindex 68649f6..529dfbf 100644 --- a/chrome/app/theme/statusbar_battery8c.png +++ b/chrome/app/theme/statusbar_battery8c.png diff --git a/chrome/app/theme/statusbar_battery8d.png b/chrome/app/theme/statusbar_battery8d.png Binary files differindex 7c9a344..0975111 100644 --- a/chrome/app/theme/statusbar_battery8d.png +++ b/chrome/app/theme/statusbar_battery8d.png diff --git a/chrome/app/theme/statusbar_battery9c.png b/chrome/app/theme/statusbar_battery9c.png Binary files differnew file mode 100644 index 0000000..f0f2972 --- /dev/null +++ b/chrome/app/theme/statusbar_battery9c.png diff --git a/chrome/app/theme/statusbar_battery9d.png b/chrome/app/theme/statusbar_battery9d.png Binary files differnew file mode 100644 index 0000000..5620cd1 --- /dev/null +++ b/chrome/app/theme/statusbar_battery9d.png diff --git a/chrome/app/theme/statusbar_battery_charged.png b/chrome/app/theme/statusbar_battery_charged.png Binary files differindex 409825b..d052c1b 100644 --- a/chrome/app/theme/statusbar_battery_charged.png +++ b/chrome/app/theme/statusbar_battery_charged.png diff --git a/chrome/app/theme/statusbar_battery_missing.png b/chrome/app/theme/statusbar_battery_missing.png Binary files differnew file mode 100644 index 0000000..4117402 --- /dev/null +++ b/chrome/app/theme/statusbar_battery_missing.png diff --git a/chrome/app/theme/statusbar_battery_unknown.png b/chrome/app/theme/statusbar_battery_unknown.png Binary files differindex 0c19337..1c68ee6 100755..100644 --- a/chrome/app/theme/statusbar_battery_unknown.png +++ b/chrome/app/theme/statusbar_battery_unknown.png diff --git a/chrome/app/theme/statusbar_container.png b/chrome/app/theme/statusbar_container.png Binary files differnew file mode 100644 index 0000000..5b480d0 --- /dev/null +++ b/chrome/app/theme/statusbar_container.png diff --git a/chrome/app/theme/statusbar_container_hover.png b/chrome/app/theme/statusbar_container_hover.png Binary files differnew file mode 100644 index 0000000..210fe5d --- /dev/null +++ b/chrome/app/theme/statusbar_container_hover.png diff --git a/chrome/app/theme/statusbar_container_pressed.png b/chrome/app/theme/statusbar_container_pressed.png Binary files differnew file mode 100755 index 0000000..df59803 --- /dev/null +++ b/chrome/app/theme/statusbar_container_pressed.png diff --git a/chrome/app/theme/statusbar_menu.png b/chrome/app/theme/statusbar_menu.png Binary files differindex 4edd2e4..a0aba01 100644 --- a/chrome/app/theme/statusbar_menu.png +++ b/chrome/app/theme/statusbar_menu.png diff --git a/chrome/app/theme/statusbar_network_disconnected.png b/chrome/app/theme/statusbar_network_disconnected.png Binary files differnew file mode 100644 index 0000000..4ca63e3 --- /dev/null +++ b/chrome/app/theme/statusbar_network_disconnected.png diff --git a/chrome/app/theme/statusbar_wifi_dot.png b/chrome/app/theme/statusbar_wifi_dot.png Binary files differnew file mode 100644 index 0000000..76d6186 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_dot.png diff --git a/chrome/app/theme/statusbar_wifi_down1.png b/chrome/app/theme/statusbar_wifi_down1.png Binary files differnew file mode 100644 index 0000000..ab31a97 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_down1.png diff --git a/chrome/app/theme/statusbar_wifi_down1p.png b/chrome/app/theme/statusbar_wifi_down1p.png Binary files differnew file mode 100644 index 0000000..f961eb1 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_down1p.png diff --git a/chrome/app/theme/statusbar_wifi_down2.png b/chrome/app/theme/statusbar_wifi_down2.png Binary files differnew file mode 100644 index 0000000..8ad080c --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_down2.png diff --git a/chrome/app/theme/statusbar_wifi_down2p.png b/chrome/app/theme/statusbar_wifi_down2p.png Binary files differnew file mode 100644 index 0000000..862fd52 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_down2p.png diff --git a/chrome/app/theme/statusbar_wifi_down3.png b/chrome/app/theme/statusbar_wifi_down3.png Binary files differnew file mode 100644 index 0000000..4c9eb46 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_down3.png diff --git a/chrome/app/theme/statusbar_wifi_down3p.png b/chrome/app/theme/statusbar_wifi_down3p.png Binary files differnew file mode 100644 index 0000000..959a797 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_down3p.png diff --git a/chrome/app/theme/statusbar_wifi_up1.png b/chrome/app/theme/statusbar_wifi_up1.png Binary files differnew file mode 100644 index 0000000..2e80214 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_up1.png diff --git a/chrome/app/theme/statusbar_wifi_up1p.png b/chrome/app/theme/statusbar_wifi_up1p.png Binary files differnew file mode 100644 index 0000000..b86496c --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_up1p.png diff --git a/chrome/app/theme/statusbar_wifi_up2.png b/chrome/app/theme/statusbar_wifi_up2.png Binary files differnew file mode 100644 index 0000000..db21721 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_up2.png diff --git a/chrome/app/theme/statusbar_wifi_up2p.png b/chrome/app/theme/statusbar_wifi_up2p.png Binary files differnew file mode 100644 index 0000000..15bacc1 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_up2p.png diff --git a/chrome/app/theme/statusbar_wifi_up3.png b/chrome/app/theme/statusbar_wifi_up3.png Binary files differnew file mode 100644 index 0000000..5789483 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_up3.png diff --git a/chrome/app/theme/statusbar_wifi_up3p.png b/chrome/app/theme/statusbar_wifi_up3p.png Binary files differnew file mode 100644 index 0000000..871d0e9 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_up3p.png diff --git a/chrome/app/theme/statusbar_wifi_warning.png b/chrome/app/theme/statusbar_wifi_warning.png Binary files differnew file mode 100644 index 0000000..d033ec2 --- /dev/null +++ b/chrome/app/theme/statusbar_wifi_warning.png diff --git a/chrome/app/theme/statusbar_wired.png b/chrome/app/theme/statusbar_wired.png Binary files differindex ac8415d..c7e03de 100755..100644 --- a/chrome/app/theme/statusbar_wired.png +++ b/chrome/app/theme/statusbar_wired.png diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 339585f..cba0fff 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -358,8 +358,12 @@ <include name="IDR_COMPACTNAV_SEPARATOR" file="compactnav_separator.png" type="BINDATA" /> <include name="IDR_STATUSBAR_MENU" file="statusbar_menu.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_CONTAINER" file="statusbar_container.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_CONTAINER_HOVER" file="statusbar_container_hover.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_CONTAINER_PRESSED" file="statusbar_container_pressed.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_CHARGED" file="statusbar_battery_charged.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_UNKNOWN" file="statusbar_battery_unknown.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_MISSING" file="statusbar_battery_missing.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_CHARGING_1" file="statusbar_battery1c.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_CHARGING_2" file="statusbar_battery2c.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_CHARGING_3" file="statusbar_battery3c.png" type="BINDATA" /> @@ -368,6 +372,14 @@ <include name="IDR_STATUSBAR_BATTERY_CHARGING_6" file="statusbar_battery6c.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_CHARGING_7" file="statusbar_battery7c.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_CHARGING_8" file="statusbar_battery8c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_9" file="statusbar_battery9c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_10" file="statusbar_battery10c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_11" file="statusbar_battery11c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_12" file="statusbar_battery12c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_13" file="statusbar_battery13c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_14" file="statusbar_battery14c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_15" file="statusbar_battery15c.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_CHARGING_16" file="statusbar_battery16c.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_1" file="statusbar_battery1d.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_2" file="statusbar_battery2d.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_3" file="statusbar_battery3d.png" type="BINDATA" /> @@ -376,7 +388,15 @@ <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_6" file="statusbar_battery6d.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_7" file="statusbar_battery7d.png" type="BINDATA" /> <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_8" file="statusbar_battery8d.png" type="BINDATA" /> - <include name="IDR_STATUSBAR_DISCONNECTED" file="statusbar_disconnected.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_9" file="statusbar_battery9d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_10" file="statusbar_battery10d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_11" file="statusbar_battery11d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_12" file="statusbar_battery12d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_13" file="statusbar_battery13d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_14" file="statusbar_battery14d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_15" file="statusbar_battery15d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_BATTERY_DISCHARGING_16" file="statusbar_battery16d.png" type="BINDATA" /> + <include name="IDR_STATUSBAR_NETWORK_DISCONNECTED" file="statusbar_network_disconnected.png" type="BINDATA" /> <include name="IDR_STATUSBAR_WIFI_1" file="statusbar_wifi_1.png" type="BINDATA" /> <include name="IDR_STATUSBAR_WIFI_2" file="statusbar_wifi_2.png" type="BINDATA" /> <include name="IDR_STATUSBAR_WIFI_3" file="statusbar_wifi_3.png" type="BINDATA" /> diff --git a/chrome/browser/chromeos/clock_menu_button.cc b/chrome/browser/chromeos/clock_menu_button.cc index 247b5fe..d89d474 100644 --- a/chrome/browser/chromeos/clock_menu_button.cc +++ b/chrome/browser/chromeos/clock_menu_button.cc @@ -26,6 +26,7 @@ ClockMenuButton::ClockMenuButton(Browser* browser) : MenuButton(NULL, std::wstring(), this, false), clock_menu_(this), browser_(browser) { + set_border(NULL); SetFont(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD)); SetEnabledColor(SK_ColorWHITE); diff --git a/chrome/browser/chromeos/cros_power_library.cc b/chrome/browser/chromeos/cros_power_library.cc index f3d8abf..ae3092b 100644 --- a/chrome/browser/chromeos/cros_power_library.cc +++ b/chrome/browser/chromeos/cros_power_library.cc @@ -56,9 +56,12 @@ bool CrosPowerLibrary::line_power_on() const { return status_.line_power_on; } +bool CrosPowerLibrary::battery_is_present() const { + return status_.battery_is_present; +} + bool CrosPowerLibrary::battery_fully_charged() const { - return status_.line_power_on && - status_.battery_state == chromeos::BATTERY_STATE_FULLY_CHARGED; + return status_.battery_state == chromeos::BATTERY_STATE_FULLY_CHARGED; } double CrosPowerLibrary::battery_percentage() const { diff --git a/chrome/browser/chromeos/cros_power_library.h b/chrome/browser/chromeos/cros_power_library.h index 3184627..e01e76d 100644 --- a/chrome/browser/chromeos/cros_power_library.h +++ b/chrome/browser/chromeos/cros_power_library.h @@ -38,6 +38,9 @@ class CrosPowerLibrary { // The percentage (0-100) of remaining battery. double battery_percentage() const; + // Whether there is a battery present. + bool battery_is_present() const; + // The amount of time until battery is empty. base::TimeDelta battery_time_to_empty() const; diff --git a/chrome/browser/chromeos/network_menu_button.cc b/chrome/browser/chromeos/network_menu_button.cc index 03746e4..93aefb5 100644 --- a/chrome/browser/chromeos/network_menu_button.cc +++ b/chrome/browser/chromeos/network_menu_button.cc @@ -22,12 +22,10 @@ const int NetworkMenuButton::kNumWifiImages = 8; const int NetworkMenuButton::kThrobDuration = 1000; NetworkMenuButton::NetworkMenuButton(gfx::NativeWindow browser_window) - : MenuButton(NULL, std::wstring(), this, false), - refreshing_menu_(false), + : StatusAreaButton(this), ALLOW_THIS_IN_INITIALIZER_LIST(network_menu_(this)), browser_window_(browser_window), ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)) { - SetShowHighlighted(false); animation_.SetThrobDuration(kThrobDuration); animation_.SetTweenType(SlideAnimation::NONE); UpdateIcon(); @@ -142,7 +140,7 @@ void NetworkMenuButton::NetworkChanged(CrosNetworkLibrary* obj) { void NetworkMenuButton::UpdateIcon() { CrosNetworkLibrary* cros = CrosNetworkLibrary::Get(); - int id = IDR_STATUSBAR_DISCONNECTED; + int id = IDR_STATUSBAR_NETWORK_DISCONNECTED; if (cros->wifi_connecting()) { // Start the connecting animation if not running. if (!animation_.IsAnimating()) diff --git a/chrome/browser/chromeos/network_menu_button.h b/chrome/browser/chromeos/network_menu_button.h index 8a97348..4d2c3d0 100644 --- a/chrome/browser/chromeos/network_menu_button.h +++ b/chrome/browser/chromeos/network_menu_button.h @@ -11,7 +11,7 @@ #include "base/timer.h" #include "chrome/browser/chromeos/cros_network_library.h" #include "chrome/browser/chromeos/password_dialog_view.h" -#include "views/controls/button/menu_button.h" +#include "chrome/browser/chromeos/status_area_button.h" #include "views/controls/menu/menu_2.h" #include "views/controls/menu/view_menu_delegate.h" @@ -22,7 +22,7 @@ class SkBitmap; // This class will handle getting the wifi networks and populating the menu. // It will also handle the status icon changing and connecting to another // wifi network. -class NetworkMenuButton : public views::MenuButton, +class NetworkMenuButton : public StatusAreaButton, public views::ViewMenuDelegate, public views::Menu2Model, public PasswordDialogDelegate, diff --git a/chrome/browser/chromeos/power_menu_button.cc b/chrome/browser/chromeos/power_menu_button.cc index 192893b..1ded368 100644 --- a/chrome/browser/chromeos/power_menu_button.cc +++ b/chrome/browser/chromeos/power_menu_button.cc @@ -14,12 +14,11 @@ // PowerMenuButton // static -const int PowerMenuButton::kNumPowerImages = 8; +const int PowerMenuButton::kNumPowerImages = 16; PowerMenuButton::PowerMenuButton() - : MenuButton(NULL, std::wstring(), this, false), + : StatusAreaButton(this), ALLOW_THIS_IN_INITIALIZER_LIST(power_menu_(this)) { - SetShowHighlighted(false); UpdateIcon(); CrosPowerLibrary::Get()->AddObserver(this); } @@ -102,7 +101,9 @@ void PowerMenuButton::UpdateIcon() { CrosPowerLibrary* cros = CrosPowerLibrary::Get(); int id = IDR_STATUSBAR_BATTERY_UNKNOWN; if (CrosPowerLibrary::loaded()) { - if (cros->battery_fully_charged()) { + if (!cros->battery_is_present()) { + id = IDR_STATUSBAR_BATTERY_MISSING; + } else if (cros->line_power_on() && cros->battery_fully_charged()) { id = IDR_STATUSBAR_BATTERY_CHARGED; } else { // If fully charged, always show 100% even if percentage is a bit less. diff --git a/chrome/browser/chromeos/power_menu_button.h b/chrome/browser/chromeos/power_menu_button.h index 7abe100..a250b26 100644 --- a/chrome/browser/chromeos/power_menu_button.h +++ b/chrome/browser/chromeos/power_menu_button.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_POWER_MENU_BUTTON_H_ #include "chrome/browser/chromeos/cros_power_library.h" -#include "views/controls/button/menu_button.h" +#include "chrome/browser/chromeos/status_area_button.h" #include "views/controls/menu/menu_2.h" #include "views/controls/menu/view_menu_delegate.h" @@ -15,8 +15,7 @@ class SkBitmap; // The power menu button in the status area. // This class will handle getting the power status and populating the menu. -// It handles the status icon changing and connecting to another wifi power. -class PowerMenuButton : public views::MenuButton, +class PowerMenuButton : public StatusAreaButton, public views::ViewMenuDelegate, public views::Menu2Model, public CrosPowerLibrary::Observer { diff --git a/chrome/browser/chromeos/status_area_button.cc b/chrome/browser/chromeos/status_area_button.cc new file mode 100644 index 0000000..694fb03 --- /dev/null +++ b/chrome/browser/chromeos/status_area_button.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/status_area_button.h" + +#include "app/gfx/canvas.h" +#include "app/gfx/skbitmap_operations.h" +#include "app/resource_bundle.h" +#include "grit/theme_resources.h" +#include "views/border.h" +#include "views/view.h" + +//////////////////////////////////////////////////////////////////////////////// +// StatusAreaButton + +StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) + : MenuButton(NULL, std::wstring(), menu_delegate, false) { + set_border(NULL); + SetShowHighlighted(true); +} + +void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { + int bitmap_id; + + switch(state()) { + case BS_NORMAL: + bitmap_id = IDR_STATUSBAR_CONTAINER; + break; + case BS_HOT: + bitmap_id = IDR_STATUSBAR_CONTAINER_HOVER; + break; + case BS_PUSHED: + bitmap_id = IDR_STATUSBAR_CONTAINER_PRESSED; + break; + default: + NOTREACHED(); + } + SkBitmap* container = + ResourceBundle::GetSharedInstance().GetBitmapNamed(bitmap_id); + canvas->DrawBitmapInt(*container, 0, 0); + canvas->DrawBitmapInt(icon(), 0, 0); +} diff --git a/chrome/browser/chromeos/status_area_button.h b/chrome/browser/chromeos/status_area_button.h new file mode 100644 index 0000000..b862215 --- /dev/null +++ b/chrome/browser/chromeos/status_area_button.h @@ -0,0 +1,20 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_STATUS_AREA_BUTTON_H_ +#define CHROME_BROWSER_CHROMEOS_STATUS_AREA_BUTTON_H_ + +#include "views/controls/button/menu_button.h" +#include "views/controls/menu/view_menu_delegate.h" + +// Button to be used to represent status and allow menus to be popped up. +// Shows current button state by drawing a border around the current icon. +class StatusAreaButton : public views::MenuButton { + public: + StatusAreaButton(views::ViewMenuDelegate* menu_delegate); + virtual ~StatusAreaButton() {} + virtual void Paint(gfx::Canvas* canvas, bool for_drag); +}; + +#endif // CHROME_BROWSER_CHROMEOS_STATUS_AREA_BUTTON_H_ diff --git a/chrome/browser/chromeos/status_area_view.cc b/chrome/browser/chromeos/status_area_view.cc index 6bb377a5..59f4f9c 100644 --- a/chrome/browser/chromeos/status_area_view.cc +++ b/chrome/browser/chromeos/status_area_view.cc @@ -16,6 +16,7 @@ #include "chrome/browser/chromeos/clock_menu_button.h" #include "chrome/browser/chromeos/network_menu_button.h" #include "chrome/browser/chromeos/power_menu_button.h" +#include "chrome/browser/chromeos/status_area_button.h" #if !defined(TOOLKIT_VIEWS) #include "chrome/browser/gtk/browser_window_gtk.h" #endif @@ -23,14 +24,17 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "views/controls/button/menu_button.h" #include "views/controls/menu/menu.h" #include "views/controls/menu/simple_menu_model.h" namespace { -// Number of pixels to separate adjacent status items. -const int kStatusItemSeparation = 1; +// Number of pixels to pad on the left border. +const int kLeftBorder = 1; +// Number of pixels to separate the clock from the next item on the right. +const int kClockSeparation = 4; +// Number of pixels to adjust the y value of the clock. +const int kClockYAdjustment = 2; // BrowserWindowGtk tiles its image with this offset const int kCustomFrameBackgroundVerticalOffset = 15; @@ -131,52 +135,56 @@ void StatusAreaView::Init() { clock_view_ = new ClockMenuButton(browser_); AddChildView(clock_view_); - // Network. - network_view_ = new NetworkMenuButton(window_); - AddChildView(network_view_); - // Battery. battery_view_ = new PowerMenuButton(); AddChildView(battery_view_); + // Network. + network_view_ = new NetworkMenuButton(window_); + AddChildView(network_view_); + // Menu. - menu_view_ = new views::MenuButton(NULL, std::wstring(), this, false); - menu_view_->SetShowHighlighted(false); + menu_view_ = new StatusAreaButton(this); menu_view_->SetIcon(*theme->GetBitmapNamed(IDR_STATUSBAR_MENU)); AddChildView(menu_view_); } gfx::Size StatusAreaView::GetPreferredSize() { - int result_w = kStatusItemSeparation; // Left border. + // Start with padding. + int result_w = kLeftBorder + kClockSeparation; int result_h = 0; for (int i = 0; i < GetChildViewCount(); i++) { gfx::Size cur_size = GetChildViewAt(i)->GetPreferredSize(); - result_w += cur_size.width() + kStatusItemSeparation; + // Add each width. + result_w += cur_size.width(); + // Use max height. result_h = std::max(result_h, cur_size.height()); } - result_w -= kStatusItemSeparation; // Don't have space after the last one. - - // TODO(brettw) do we need to use result_h? This is currently hardcoded - // becuase the menu button really wants to be larger, but we don't want - // the status bar to force the whole tab strip to be larger. Making it - // "smaller" just means that we'll expand to the height, which we want. - // The height of 24 makes it just big enough to sit on top of the shadow - // drawn by the browser window. - return gfx::Size(result_w - kStatusItemSeparation, 24); + return gfx::Size(result_w, result_h); } void StatusAreaView::Layout() { - int cur_x = 0; + int cur_x = kLeftBorder; for (int i = 0; i < GetChildViewCount(); i++) { views::View* cur = GetChildViewAt(i); gfx::Size cur_size = cur->GetPreferredSize(); + int cur_y = (height() - cur_size.height()) / 2; + + // Handle odd number of pixels. + cur_y += (height() - cur_size.height()) % 2; + + // Adjustment to make clock line up right. + if (cur == clock_view_) + cur_y += kClockYAdjustment; // Put next in row horizontally, and center vertically. - // Padding the y position by 1 balances the space above and - // below the icons, but still allows the shadow to be drawn. - cur->SetBounds(cur_x, (height() - cur_size.height()) / 2 + 1, - cur_size.width(), cur_size.height()); - cur_x += cur_size.width() + kStatusItemSeparation; + cur->SetBounds(cur_x, cur_y, cur_size.width(), cur_size.height()); + + cur_x += cur_size.width(); + + // Buttons have built in padding, but clock doesn't. + if (cur == clock_view_) + cur_x += kClockSeparation; } } diff --git a/chrome/browser/chromeos/status_area_view.h b/chrome/browser/chromeos/status_area_view.h index 071b99b..9428697 100644 --- a/chrome/browser/chromeos/status_area_view.h +++ b/chrome/browser/chromeos/status_area_view.h @@ -15,10 +15,7 @@ class Browser; class ClockMenuButton; class NetworkMenuButton; class PowerMenuButton; - -namespace views { -class MenuButton; -} +class StatusAreaButton; // This class is used to wrap the small informative widgets in the upper-right // of the window title bar. It is used on ChromeOS only. @@ -70,7 +67,7 @@ class StatusAreaView : public views::View, ClockMenuButton* clock_view_; NetworkMenuButton* network_view_; PowerMenuButton* battery_view_; - views::MenuButton* menu_view_; + StatusAreaButton* menu_view_; scoped_ptr<views::SimpleMenuModel> app_menu_contents_; scoped_ptr<views::SimpleMenuModel> options_menu_contents_; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index f6bafc2..fcce41d 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -990,6 +990,8 @@ 'browser/chromeos/settings_contents_view.h', 'browser/chromeos/settings_page_view.cc', 'browser/chromeos/settings_page_view.h', + 'browser/chromeos/status_area_button.cc', + 'browser/chromeos/status_area_button.h', 'browser/chromeos/status_area_view.cc', 'browser/chromeos/status_area_view.h', 'browser/chromeos/touchpad.cc', |