diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 03:42:45 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 03:42:45 +0000 |
commit | 9d58a450c4447ce363c9272a04454776590f9814 (patch) | |
tree | 76f99ad8cceb3ec8049f94493b64c5f1c7fc8491 /ash | |
parent | 8a360a4ca8a2afe8ec6eb47df414667f6d7661c0 (diff) | |
download | chromium_src-9d58a450c4447ce363c9272a04454776590f9814.zip chromium_src-9d58a450c4447ce363c9272a04454776590f9814.tar.gz chromium_src-9d58a450c4447ce363c9272a04454776590f9814.tar.bz2 |
Revert 153141 - Adjust the power status UI to left aligned UI if the Settings is not displayed on the uber tray bubble.
BUG=138186
Review URL: https://chromiumcodereview.appspot.com/10877029
TBR=jennyz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10870059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/system/power/power_status_view.cc | 36 | ||||
-rw-r--r-- | ash/system/power/power_status_view.h | 6 | ||||
-rw-r--r-- | ash/system/power/tray_power.cc | 2 | ||||
-rw-r--r-- | ash/system/settings/tray_settings.cc | 12 |
4 files changed, 16 insertions, 40 deletions
diff --git a/ash/system/power/power_status_view.cc b/ash/system/power/power_status_view.cc index 8fabe3b..3b39426 100644 --- a/ash/system/power/power_status_view.cc +++ b/ash/system/power/power_status_view.cc @@ -6,7 +6,6 @@ #include "ash/system/power/tray_power.h" #include "ash/system/tray/tray_constants.h" -#include "ash/system/tray/tray_views.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "grit/ash_strings.h" @@ -30,10 +29,8 @@ const int kLabelMinWidth = 120; const int kPaddingBetweenBatteryStatusAndIcon = 3; } // namespace -PowerStatusView::PowerStatusView(ViewType view_type, - bool default_view_right_align) - : default_view_right_align_(default_view_right_align), - status_label_(NULL), +PowerStatusView::PowerStatusView(ViewType view_type) + : status_label_(NULL), time_label_(NULL), time_status_label_(NULL), icon_(NULL), @@ -59,29 +56,16 @@ void PowerStatusView::UpdatePowerStatus(const PowerSupplyStatus& status) { } void PowerStatusView::LayoutDefaultView() { - if (default_view_right_align_) { - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, - kPaddingBetweenBatteryStatusAndIcon); - SetLayoutManager(layout); + views::BoxLayout* layout = + new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, + kPaddingBetweenBatteryStatusAndIcon); + SetLayoutManager(layout); - AddChildView(time_status_label_); + time_status_label_->SetHorizontalAlignment(views::Label::ALIGN_RIGHT); + AddChildView(time_status_label_); - icon_ = new views::ImageView; - AddChildView(icon_); - } else { - // PowerStatusView is left aligned on the system tray pop up item. - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, - kTrayPopupPaddingBetweenItems); - SetLayoutManager(layout); - - icon_ = - new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); - AddChildView(icon_); - - AddChildView(time_status_label_); - } + icon_ = new views::ImageView; + AddChildView(icon_); } void PowerStatusView::LayoutNotificationView() { diff --git a/ash/system/power/power_status_view.h b/ash/system/power/power_status_view.h index 340cd46..c4eca99 100644 --- a/ash/system/power/power_status_view.h +++ b/ash/system/power/power_status_view.h @@ -23,7 +23,7 @@ class PowerStatusView : public views::View { VIEW_NOTIFICATION }; - PowerStatusView(ViewType view_type, bool default_view_right_align); + explicit PowerStatusView(ViewType view_type); virtual ~PowerStatusView() {} void UpdatePowerStatus(const PowerSupplyStatus& status); @@ -43,10 +43,6 @@ class PowerStatusView : public views::View { // Overridden from views::View. virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; - // Layout default view UI items on the right side of system tray pop up item - // if true; otherwise, layout the UI items on the left side. - bool default_view_right_align_; - // labels used only for VIEW_NOTIFICATION. views::Label* status_label_; views::Label* time_label_; diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc index cb8f037..48d3f3c 100644 --- a/ash/system/power/tray_power.cc +++ b/ash/system/power/tray_power.cc @@ -95,7 +95,7 @@ class PowerNotificationView : public TrayNotificationView { explicit PowerNotificationView(TrayPower* tray) : TrayNotificationView(tray, 0) { power_status_view_ = - new PowerStatusView(PowerStatusView::VIEW_NOTIFICATION, true); + new PowerStatusView(PowerStatusView::VIEW_NOTIFICATION); InitView(power_status_view_); } diff --git a/ash/system/settings/tray_settings.cc b/ash/system/settings/tray_settings.cc index 47939da..c28a3ea 100644 --- a/ash/system/settings/tray_settings.cc +++ b/ash/system/settings/tray_settings.cc @@ -32,13 +32,11 @@ class SettingsDefaultView : public ash::internal::ActionableView { public: explicit SettingsDefaultView(user::LoginStatus status) : login_status_(status), - label_(NULL), power_status_view_(NULL) { SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, ash::kTrayPopupPaddingHorizontal, 0, ash::kTrayPopupPaddingBetweenItems)); - bool power_view_right_align = false; if (login_status_ != user::LOGGED_IN_NONE && login_status_ != user::LOGGED_IN_LOCKED) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); @@ -52,15 +50,13 @@ class SettingsDefaultView : public ash::internal::ActionableView { label_ = new views::Label(text); AddChildView(label_); SetAccessibleName(text); - - power_view_right_align = true; } PowerSupplyStatus power_status = ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus(); if (power_status.battery_is_present) { power_status_view_ = new ash::internal::PowerStatusView( - ash::internal::PowerStatusView::VIEW_DEFAULT, power_view_right_align); + ash::internal::PowerStatusView::VIEW_DEFAULT); AddChildView(power_status_view_); UpdatePowerStatus(power_status); } @@ -85,11 +81,11 @@ class SettingsDefaultView : public ash::internal::ActionableView { // Overridden from views::View. virtual void Layout() OVERRIDE { + // Let the box-layout do the layout first. Then move power_status_view_ + // to right align if it is created. views::View::Layout(); - if (label_) { - // Let the box-layout do the layout first. Then move power_status_view_ - // to right align if it is created. + if (power_status_view_) { gfx::Size size = power_status_view_->GetPreferredSize(); gfx::Rect bounds(size); bounds.set_x(width() - size.width() - ash::kTrayPopupPaddingBetweenItems); |