Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5106)

Unified Diff: ash/common/system/chromeos/power/tray_power.cc

Issue 2455183002: Simplify layout of tray items and fix spacing for MD. (Closed)
Patch Set: tda review Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/chromeos/network/tray_network.cc ('k') | ash/common/system/date/date_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/power/tray_power.cc
diff --git a/ash/common/system/chromeos/power/tray_power.cc b/ash/common/system/chromeos/power/tray_power.cc
index 250c273e90700c34bc2e5219c92d7076a6aa05e6..a3b248f9663fa4e46777d9011ba98d7a62102df2 100644
--- a/ash/common/system/chromeos/power/tray_power.cc
+++ b/ash/common/system/chromeos/power/tray_power.cc
@@ -15,6 +15,7 @@
#include "ash/common/system/system_notifier.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/system/tray/tray_constants.h"
+#include "ash/common/system/tray/tray_item_view.h"
#include "ash/common/system/tray/tray_utils.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -90,9 +91,12 @@ void LogBatteryForNoCharger(TrayPower::NotificationState state,
namespace tray {
// This view is used only for the tray.
-class PowerTrayView : public views::ImageView {
+class PowerTrayView : public TrayItemView {
public:
- PowerTrayView() { UpdateImage(); }
+ explicit PowerTrayView(SystemTrayItem* owner) : TrayItemView(owner) {
+ CreateImageView();
+ UpdateImage();
+ }
~PowerTrayView() override {}
@@ -117,7 +121,7 @@ class PowerTrayView : public views::ImageView {
const PowerStatus::BatteryImageInfo info =
PowerStatus::Get()->GetBatteryImageInfo(PowerStatus::ICON_LIGHT);
if (info != previous_image_info_) {
- SetImage(PowerStatus::Get()->GetBatteryImage(info));
+ image_view()->SetImage(PowerStatus::Get()->GetBatteryImage(info));
previous_image_info_ = info;
}
}
@@ -163,7 +167,7 @@ views::View* TrayPower::CreateTrayView(LoginStatus status) {
// there is a battery or not. So always create this, and adjust visibility as
// necessary.
CHECK(power_tray_ == NULL);
- power_tray_ = new tray::PowerTrayView();
+ power_tray_ = new tray::PowerTrayView(this);
power_tray_->UpdateStatus(false);
return power_tray_;
}
« no previous file with comments | « ash/common/system/chromeos/network/tray_network.cc ('k') | ash/common/system/date/date_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698