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

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

Issue 2795823002: Remove pre-MD code from PowerStatusView. (Closed)
Patch Set: remove todo Created 3 years, 8 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
Index: ash/common/system/chromeos/power/power_status_view.cc
diff --git a/ash/common/system/chromeos/power/power_status_view.cc b/ash/common/system/chromeos/power/power_status_view.cc
index e7d5b1d841d7bfae274f111b2639bb7bdf02da38..2c4469cd7da35578c1199de6c7f85df857bdb17c 100644
--- a/ash/common/system/chromeos/power/power_status_view.cc
+++ b/ash/common/system/chromeos/power/power_status_view.cc
@@ -4,8 +4,6 @@
#include "ash/common/system/chromeos/power/power_status_view.h"
-#include "ash/common/material_design/material_design_controller.h"
-#include "ash/common/system/chromeos/power/power_status.h"
#include "ash/common/system/chromeos/power/tray_power.h"
#include "ash/common/system/tray/fixed_sized_image_view.h"
#include "ash/common/system/tray/tray_constants.h"
@@ -25,21 +23,24 @@
namespace ash {
-// Padding between battery status text and battery icon on default view.
-const int kPaddingBetweenBatteryStatusAndIcon = 3;
-
-PowerStatusView::PowerStatusView(bool default_view_right_align)
- : default_view_right_align_(default_view_right_align),
- percentage_label_(new views::Label),
+PowerStatusView::PowerStatusView()
+ : percentage_label_(new views::Label),
separator_label_(new views::Label),
time_status_label_(new views::Label) {
- if (MaterialDesignController::IsSystemTrayMenuMaterial())
- SetFocusBehavior(FocusBehavior::ALWAYS);
+ SetFocusBehavior(FocusBehavior::ALWAYS);
percentage_label_->SetEnabledColor(kHeaderTextColorNormal);
separator_label_->SetEnabledColor(kHeaderTextColorNormal);
separator_label_->SetText(base::ASCIIToUTF16(" - "));
- LayoutView();
+
+ views::BoxLayout* layout = new views::BoxLayout(
+ views::BoxLayout::kHorizontal, 12, 0, kTrayPopupPaddingBetweenItems);
+ SetLayoutManager(layout);
+
+ AddChildView(percentage_label_);
+ AddChildView(separator_label_);
+ AddChildView(time_status_label_);
+
PowerStatus::Get()->AddObserver(this);
OnPowerStatusChanged();
}
@@ -52,37 +53,6 @@ void PowerStatusView::OnPowerStatusChanged() {
UpdateText();
}
-void PowerStatusView::LayoutView() {
- if (default_view_right_align_) {
- views::BoxLayout* layout =
- new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0,
- kPaddingBetweenBatteryStatusAndIcon);
- SetLayoutManager(layout);
-
- AddChildView(percentage_label_);
- AddChildView(separator_label_);
- AddChildView(time_status_label_);
- AddChildView(new views::ImageView);
-
- return;
- }
-
- // TODO(tdanderson): Tweak padding values for material design.
- const bool material_design =
- MaterialDesignController::IsSystemTrayMenuMaterial();
- views::BoxLayout* layout = new views::BoxLayout(
- views::BoxLayout::kHorizontal, material_design ? 12 : 0, 0,
- kTrayPopupPaddingBetweenItems);
- SetLayoutManager(layout);
-
- if (!material_design)
- AddChildView(TrayPopupUtils::CreateMainImageView());
-
- AddChildView(percentage_label_);
- AddChildView(separator_label_);
- AddChildView(time_status_label_);
-}
-
void PowerStatusView::UpdateText() {
const PowerStatus& status = *PowerStatus::Get();
base::string16 battery_percentage;
@@ -124,14 +94,12 @@ void PowerStatusView::UpdateText() {
time_status_label_->SetVisible(!battery_time_status.empty());
time_status_label_->SetText(battery_time_status);
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
- accessible_name_ = PowerStatus::Get()->GetAccessibleNameString(true);
+ accessible_name_ = PowerStatus::Get()->GetAccessibleNameString(true);
- TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO);
- style.SetupLabel(percentage_label_);
- style.SetupLabel(separator_label_);
- style.SetupLabel(time_status_label_);
- }
+ TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO);
+ style.SetupLabel(percentage_label_);
+ style.SetupLabel(separator_label_);
+ style.SetupLabel(time_status_label_);
}
void PowerStatusView::ChildPreferredSizeChanged(views::View* child) {
@@ -151,9 +119,6 @@ void PowerStatusView::Layout() {
}
void PowerStatusView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
- if (!MaterialDesignController::IsSystemTrayMenuMaterial())
- return;
-
node_data->role = ui::AX_ROLE_LABEL_TEXT;
node_data->SetName(accessible_name_);
}
« no previous file with comments | « ash/common/system/chromeos/power/power_status_view.h ('k') | ash/common/system/chromeos/power/power_status_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698