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

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

Issue 2063633002: Render Ash material design battery image icon without PNGs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add battery percentage constant Created 4 years, 6 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 a30ce2c45022b41134f8ecad63c01a57de244230..17ee1df07440b4bbcb4085b04563ab4a33ce5636 100644
--- a/ash/common/system/chromeos/power/power_status_view.cc
+++ b/ash/common/system/chromeos/power/power_status_view.cc
@@ -4,6 +4,7 @@
#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"
@@ -43,11 +44,17 @@ PowerStatusView::~PowerStatusView() {
void PowerStatusView::OnPowerStatusChanged() {
UpdateText();
+
+ // We do not show a battery icon in the material design system menu.
+ // TODO(tdanderson): Remove the non-MD code and the IconSet enum once
+ // material design is enabled by default. See crbug.com/614453.
+ if (MaterialDesignController::UseMaterialDesignSystemIcons())
+ return;
+
const PowerStatus::BatteryImageInfo info =
PowerStatus::Get()->GetBatteryImageInfo(PowerStatus::ICON_DARK);
if (info != previous_battery_image_info_) {
- icon_->SetImage(
- PowerStatus::Get()->GetBatteryImage(PowerStatus::ICON_DARK));
+ icon_->SetImage(PowerStatus::Get()->GetBatteryImage(info));
icon_->SetVisible(true);
previous_battery_image_info_ = info;
}
« no previous file with comments | « ash/common/system/chromeos/power/power_status_unittest.cc ('k') | ash/common/system/chromeos/power/tray_power.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698