diff options
22 files changed, 60 insertions, 31 deletions
diff --git a/ash/system/audio/tray_volume.cc b/ash/system/audio/tray_volume.cc index e02fd1a..4fdc77e 100644 --- a/ash/system/audio/tray_volume.cc +++ b/ash/system/audio/tray_volume.cc @@ -27,9 +27,9 @@ namespace ash { namespace internal { namespace { -const int kVolumeImageWidth = 44; -const int kVolumeImageHeight = 44; -const int kVolumeLevel = 5; +const int kVolumeImageWidth = 25; +const int kVolumeImageHeight = 25; +const int kVolumeLevel = 4; } namespace tray { @@ -39,8 +39,10 @@ class VolumeButton : public views::ToggleImageButton { explicit VolumeButton(views::ButtonListener* listener) : views::ToggleImageButton(listener), image_index_(-1) { + SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); image_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed( IDR_AURA_UBER_TRAY_VOLUME_LEVELS); + SetPreferredSize(gfx::Size(kTrayPopupItemHeight, kTrayPopupItemHeight)); Update(); } @@ -70,6 +72,12 @@ class VolumeButton : public views::ToggleImageButton { private: // Overridden from views::View. + virtual gfx::Size GetPreferredSize() OVERRIDE { + gfx::Size size = views::ToggleImageButton::GetPreferredSize(); + size.set_height(kTrayPopupItemHeight); + return size; + } + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { views::ToggleImageButton::OnPaint(canvas); diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc index 7732e34..975895f 100644 --- a/ash/system/bluetooth/tray_bluetooth.cc +++ b/ash/system/bluetooth/tray_bluetooth.cc @@ -35,9 +35,9 @@ class BluetoothDefaultView : public TrayItemMore { kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - views::ImageView* icon = new views::ImageView; + views::ImageView* icon = new FixedSizedImageView(0, kTrayPopupItemHeight); icon->SetImage(bundle.GetImageNamed( - IDR_AURA_UBER_TRAY_BLUETOOTH_LARGE).ToSkBitmap()); + IDR_AURA_UBER_TRAY_BLUETOOTH).ToSkBitmap()); AddChildView(icon); label_ = new views::Label; @@ -177,7 +177,7 @@ class BluetoothDetailedView : public views::View, } // namespace tray TrayBluetooth::TrayBluetooth() - : TrayImageItem(IDR_AURA_UBER_TRAY_BLUETOOTH_SMALL) { + : TrayImageItem(IDR_AURA_UBER_TRAY_BLUETOOTH) { } TrayBluetooth::~TrayBluetooth() { diff --git a/ash/system/brightness/tray_brightness.cc b/ash/system/brightness/tray_brightness.cc index 9afb238..0a1e987 100644 --- a/ash/system/brightness/tray_brightness.cc +++ b/ash/system/brightness/tray_brightness.cc @@ -9,6 +9,7 @@ #include "ash/system/brightness/brightness_control_delegate.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/tray_constants.h" +#include "ash/system/tray/tray_views.h" #include "base/utf_string_conversions.h" #include "grit/ui_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -33,7 +34,7 @@ class BrightnessView : public views::View, SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); - views::ImageView* icon = new views::ImageView(); + views::ImageView* icon = new FixedSizedImageView(0, kTrayPopupItemHeight); gfx::Image image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( IDR_AURA_UBER_TRAY_BRIGHTNESS); icon->SetImage(image.ToSkBitmap()); diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc index 2667a5e..cf05568 100644 --- a/ash/system/ime/tray_ime.cc +++ b/ash/system/ime/tray_ime.cc @@ -35,7 +35,7 @@ class IMEDefaultView : public TrayItemMore { kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - views::ImageView* icon = new views::ImageView; + views::ImageView* icon = new FixedSizedImageView(0, kTrayPopupItemHeight); icon->SetImage(bundle.GetImageNamed( IDR_AURA_UBER_TRAY_IME).ToSkBitmap()); AddChildView(icon); diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc index 4d51076..8faa0a8 100644 --- a/ash/system/network/tray_network.cc +++ b/ash/system/network/tray_network.cc @@ -46,12 +46,14 @@ class NetworkTrayView : public views::View { explicit NetworkTrayView(ResourceSize size) : resource_size_(size) { SetLayoutManager(new views::FillLayout()); - image_view_ = new views::ImageView; + image_view_ = resource_size_ == LARGE ? + new FixedSizedImageView(0, kTrayPopupItemHeight) : + new views::ImageView; AddChildView(image_view_); NetworkIconInfo info; Shell::GetInstance()->tray_delegate()-> - GetMostRelevantNetworkIcon(&info, resource_size_ == LARGE); + GetMostRelevantNetworkIcon(&info, false); Update(info); } @@ -86,7 +88,7 @@ class NetworkDefaultView : public TrayItemMore { NetworkIconInfo info; Shell::GetInstance()->tray_delegate()-> - GetMostRelevantNetworkIcon(&info, true); + GetMostRelevantNetworkIcon(&info, false); Update(info); } diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc index 979a81c..cae430a 100644 --- a/ash/system/power/tray_power.cc +++ b/ash/system/power/tray_power.cc @@ -38,7 +38,7 @@ namespace { const int kBatteryImageHeight = 25; const int kBatteryImageWidth = 25; // Number of different power states. -const int kNumPowerImages = 16; +const int kNumPowerImages = 15; } namespace tray { @@ -127,7 +127,8 @@ class PowerPopupView : public views::Label { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); if (hour && min) { SetText(l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_BATTERY_STATUS, - UTF8ToUTF16(base::DoubleToString(supply_status_.battery_percentage)), + base::IntToString16( + static_cast<int>(supply_status_.battery_percentage)), base::IntToString16(hour), base::IntToString16(min))); } else { diff --git a/ash/system/settings/tray_settings.cc b/ash/system/settings/tray_settings.cc index 77ebd7e..04b7b8c 100644 --- a/ash/system/settings/tray_settings.cc +++ b/ash/system/settings/tray_settings.cc @@ -7,6 +7,7 @@ #include "ash/shell.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/tray_constants.h" +#include "ash/system/tray/tray_views.h" #include "base/logging.h" #include "base/utf_string_conversions.h" #include "grit/ash_strings.h" @@ -30,7 +31,8 @@ class SettingsView : public views::View { ash::kTrayPopupPaddingBetweenItems)); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - views::ImageView* icon = new views::ImageView; + views::ImageView* icon = + new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); icon->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToSkBitmap()); AddChildView(icon); diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc index b5879a0..076e3ed 100644 --- a/ash/system/tray/tray_constants.cc +++ b/ash/system/tray/tray_constants.cc @@ -11,8 +11,9 @@ namespace ash { const int kTrayPaddingBetweenItems = 8; const int kTrayPopupAutoCloseDelayInSeconds = 2; const int kTrayPopupPaddingHorizontal = 18; -const int kTrayPopupPaddingBetweenItems = 5; +const int kTrayPopupPaddingBetweenItems = 10; +const int kTrayPopupItemHeight = 48; const int kTrayPopupDetailsIconWidth = 27; const SkColor kBackgroundColor = SK_ColorWHITE; diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h index 022ab46..df1ea5c 100644 --- a/ash/system/tray/tray_constants.h +++ b/ash/system/tray/tray_constants.h @@ -15,8 +15,10 @@ extern const int kTrayPopupAutoCloseDelayInSeconds; extern const int kTrayPopupPaddingHorizontal; extern const int kTrayPopupPaddingBetweenItems; +extern const int kTrayPopupItemHeight; extern const int kTrayPopupDetailsIconWidth; + extern const SkColor kBackgroundColor; extern const SkColor kHoverBackgroundColor; diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc index 214a83d..cbc7a7f 100644 --- a/ash/system/tray/tray_views.cc +++ b/ash/system/tray/tray_views.cc @@ -21,19 +21,22 @@ const int kIconPaddingLeft = 5; } //////////////////////////////////////////////////////////////////////////////// -// FixedWidthImageView +// FixedSizedImageView -FixedWidthImageView::FixedWidthImageView() { +FixedSizedImageView::FixedSizedImageView(int width, int height) + : width_(width), + height_(height) { SetHorizontalAlignment(views::ImageView::CENTER); SetVerticalAlignment(views::ImageView::CENTER); } -FixedWidthImageView::~FixedWidthImageView() { +FixedSizedImageView::~FixedSizedImageView() { } -gfx::Size FixedWidthImageView::GetPreferredSize() { +gfx::Size FixedSizedImageView::GetPreferredSize() { gfx::Size size = views::ImageView::GetPreferredSize(); - return gfx::Size(kTrayPopupDetailsIconWidth, size.height()); + return gfx::Size(width_ ? width_ : size.width(), + height_ ? height_ : size.height()); } //////////////////////////////////////////////////////////////////////////////// @@ -52,7 +55,8 @@ void HoverHighlightView::AddIconAndLabel(const SkBitmap& image, gfx::Font::FontStyle style) { SetLayoutManager(new views::BoxLayout( views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft)); - views::ImageView* image_view = new FixedWidthImageView; + views::ImageView* image_view = + new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); image_view->SetImage(image); AddChildView(image_view); @@ -133,7 +137,8 @@ views::View* CreateDetailedHeaderEntry(int string_id, HoverHighlightView* container = new HoverHighlightView(listener); container->SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, 5)); - views::ImageView* back = new FixedWidthImageView; + views::ImageView* back = + new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); back->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap()); container->AddChildView(back); views::Label* header = new views::Label(rb.GetLocalizedString(string_id)); diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h index 94b1c97..5c69526 100644 --- a/ash/system/tray/tray_views.h +++ b/ash/system/tray/tray_views.h @@ -21,16 +21,20 @@ class Label; namespace ash { namespace internal { -// An image view with that always has a fixed width (kTrayPopupDetailsIconWidth) -class FixedWidthImageView : public views::ImageView { +// An image view with a specified width and height (kTrayPopupDetailsIconWidth). +// If the specified width or height is zero, then the image size is used for +// that dimension. +class FixedSizedImageView : public views::ImageView { public: - FixedWidthImageView(); - virtual ~FixedWidthImageView(); + FixedSizedImageView(int width, int height); + virtual ~FixedSizedImageView(); private: virtual gfx::Size GetPreferredSize() OVERRIDE; - DISALLOW_COPY_AND_ASSIGN(FixedWidthImageView); + int width_; + int height_; + DISALLOW_COPY_AND_ASSIGN(FixedSizedImageView); }; class ViewClickListener { diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index 968529a..74e6962 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -216,7 +216,10 @@ class UserView : public views::View, username_ = new views::Label(UTF8ToUTF16(tray->GetUserDisplayName())); username_->SetFont(username_->font().DeriveFont(2)); username_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); - user->AddChildView(username_); + // Username is not made visible yet, because chromeos does not have support + // for that yet. See http://crosbug/23624 + username_->SetVisible(false); + AddChildView(username_); email_ = new views::Label(UTF8ToUTF16(tray->GetUserEmail())); email_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -288,6 +291,7 @@ class RoundedImageView : public views::View { resized_ = skia::ImageOperations::Resize(image_, skia::ImageOperations::RESIZE_BEST, size.width(), size.height()); PreferredSizeChanged(); + SchedulePaint(); } // Overridden from views::View. diff --git a/ui/resources/aura/status_bluetooth.png b/ui/resources/aura/status_bluetooth.png Binary files differindex 20e3ebb..4cf1d3f 100644 --- a/ui/resources/aura/status_bluetooth.png +++ b/ui/resources/aura/status_bluetooth.png diff --git a/ui/resources/aura/status_bluetooth_large.png b/ui/resources/aura/status_bluetooth_large.png Binary files differdeleted file mode 100644 index 20e3ebb..0000000 --- a/ui/resources/aura/status_bluetooth_large.png +++ /dev/null diff --git a/ui/resources/aura/status_bluetooth_small.png b/ui/resources/aura/status_bluetooth_small.png Binary files differdeleted file mode 100644 index 4cf1d3f..0000000 --- a/ui/resources/aura/status_bluetooth_small.png +++ /dev/null diff --git a/ui/resources/aura/status_brightness.png b/ui/resources/aura/status_brightness.png Binary files differindex 3d08bee..c4ecd1c 100644 --- a/ui/resources/aura/status_brightness.png +++ b/ui/resources/aura/status_brightness.png diff --git a/ui/resources/aura/status_ime.png b/ui/resources/aura/status_ime.png Binary files differnew file mode 100644 index 0000000..ac18174 --- /dev/null +++ b/ui/resources/aura/status_ime.png diff --git a/ui/resources/aura/status_ime_large.png b/ui/resources/aura/status_ime_large.png Binary files differdeleted file mode 100644 index ba8fb40..0000000 --- a/ui/resources/aura/status_ime_large.png +++ /dev/null diff --git a/ui/resources/aura/status_power_small_all.png b/ui/resources/aura/status_power_small_all.png Binary files differindex e1474f2..9e2b590 100644 --- a/ui/resources/aura/status_power_small_all.png +++ b/ui/resources/aura/status_power_small_all.png diff --git a/ui/resources/aura/status_settings.png b/ui/resources/aura/status_settings.png Binary files differindex 8743bd4..6a70791 100644 --- a/ui/resources/aura/status_settings.png +++ b/ui/resources/aura/status_settings.png diff --git a/ui/resources/aura/status_volume_all.png b/ui/resources/aura/status_volume_all.png Binary files differindex 044a5ec..6f666df 100644 --- a/ui/resources/aura/status_volume_all.png +++ b/ui/resources/aura/status_volume_all.png diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd index 016cdbd..1e4cc1f 100644 --- a/ui/resources/ui_resources.grd +++ b/ui/resources/ui_resources.grd @@ -383,9 +383,8 @@ <include name="IDR_AURA_UBER_TRAY_LESS" file="aura/status_less.png" type="BINDATA" /> <include name="IDR_AURA_UBER_TRAY_ACCESSIBILITY" file="aura/status_accessibility_mode.png" type="BINDATA" /> <include name="IDR_AURA_UBER_TRAY_CAPS_LOCK" file="aura/status_capslock.png" type="BINDATA" /> - <include name="IDR_AURA_UBER_TRAY_BLUETOOTH_SMALL" file="aura/status_bluetooth_small.png" type="BINDATA" /> - <include name="IDR_AURA_UBER_TRAY_BLUETOOTH_LARGE" file="aura/status_bluetooth_large.png" type="BINDATA" /> - <include name="IDR_AURA_UBER_TRAY_IME" file="aura/status_ime_large.png" type="BINDATA" /> + <include name="IDR_AURA_UBER_TRAY_BLUETOOTH" file="aura/status_bluetooth.png" type="BINDATA" /> + <include name="IDR_AURA_UBER_TRAY_IME" file="aura/status_ime.png" type="BINDATA" /> <include name="IDR_OAK" file="oak.png" type="BINDATA"/> </if> |