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

Side by Side Diff: ash/system/chromeos/power/power_status.cc

Issue 107103004: Implement the spring charger replacement UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/chromeos/power/power_status.h" 5 #include "ash/system/chromeos/power/power_status.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 bool PowerStatus::IsMainsChargerConnected() const { 181 bool PowerStatus::IsMainsChargerConnected() const {
182 return proto_.external_power() == 182 return proto_.external_power() ==
183 power_manager::PowerSupplyProperties_ExternalPower_AC; 183 power_manager::PowerSupplyProperties_ExternalPower_AC;
184 } 184 }
185 185
186 bool PowerStatus::IsUsbChargerConnected() const { 186 bool PowerStatus::IsUsbChargerConnected() const {
187 return proto_.external_power() == 187 return proto_.external_power() ==
188 power_manager::PowerSupplyProperties_ExternalPower_USB; 188 power_manager::PowerSupplyProperties_ExternalPower_USB;
189 } 189 }
190 190
191 bool PowerStatus::IsOriginalSpringChargerConnected() const {
192 // Use the hard coded enum integer value for
193 // PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER
194 // in purpose of backport compatibility.
Daniel Erat 2013/12/06 17:43:26 nit: add a TODO to change this to PowerSupplyPrope
jennyz 2013/12/06 18:15:16 Done.
195 return proto_.external_power() == 3;
196 }
197
191 gfx::ImageSkia PowerStatus::GetBatteryImage(IconSet icon_set) const { 198 gfx::ImageSkia PowerStatus::GetBatteryImage(IconSet icon_set) const {
192 gfx::Image all; 199 gfx::Image all;
193 if (IsUsbChargerConnected()) { 200 if (IsUsbChargerConnected()) {
194 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 201 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
195 icon_set == ICON_DARK ? 202 icon_set == ICON_DARK ?
196 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE_DARK : 203 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE_DARK :
197 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE); 204 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE);
198 } else { 205 } else {
199 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 206 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
200 icon_set == ICON_DARK ? 207 icon_set == ICON_DARK ?
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 294
288 void PowerStatus::PowerChanged( 295 void PowerStatus::PowerChanged(
289 const power_manager::PowerSupplyProperties& proto) { 296 const power_manager::PowerSupplyProperties& proto) {
290 proto_ = proto; 297 proto_ = proto;
291 SanitizeProto(&proto_); 298 SanitizeProto(&proto_);
292 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); 299 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged());
293 } 300 }
294 301
295 } // namespace internal 302 } // namespace internal
296 } // namespace ash 303 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698