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

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

Issue 102373006: Merge 240486 "Implement the spring charger replacement UI and ad..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1650/src/
Patch Set: 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
« no previous file with comments | « ash/system/chromeos/power/power_status.h ('k') | ash/system/chromeos/power/tray_power.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 bool PowerStatus::IsMainsChargerConnected() const { 179 bool PowerStatus::IsMainsChargerConnected() const {
180 return proto_.external_power() == 180 return proto_.external_power() ==
181 power_manager::PowerSupplyProperties_ExternalPower_AC; 181 power_manager::PowerSupplyProperties_ExternalPower_AC;
182 } 182 }
183 183
184 bool PowerStatus::IsUsbChargerConnected() const { 184 bool PowerStatus::IsUsbChargerConnected() const {
185 return proto_.external_power() == 185 return proto_.external_power() ==
186 power_manager::PowerSupplyProperties_ExternalPower_USB; 186 power_manager::PowerSupplyProperties_ExternalPower_USB;
187 } 187 }
188 188
189 bool PowerStatus::IsOriginalSpringChargerConnected() const {
190 // Use the hard coded enum integer value for
191 // PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER
192 // in purpose of backport compatibility.
193 // TODO(jennyz): change this to use
194 // PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER on trunk
195 // after the change has been merged.
196 return proto_.external_power() == 3;
197 }
198
189 gfx::ImageSkia PowerStatus::GetBatteryImage(IconSet icon_set) const { 199 gfx::ImageSkia PowerStatus::GetBatteryImage(IconSet icon_set) const {
190 gfx::Image all; 200 gfx::Image all;
191 if (IsUsbChargerConnected()) { 201 if (IsUsbChargerConnected()) {
192 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 202 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
193 icon_set == ICON_DARK ? 203 icon_set == ICON_DARK ?
194 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE_DARK : 204 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE_DARK :
195 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE); 205 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE);
196 } else { 206 } else {
197 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 207 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
198 icon_set == ICON_DARK ? 208 icon_set == ICON_DARK ?
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 295
286 void PowerStatus::PowerChanged( 296 void PowerStatus::PowerChanged(
287 const power_manager::PowerSupplyProperties& proto) { 297 const power_manager::PowerSupplyProperties& proto) {
288 proto_ = proto; 298 proto_ = proto;
289 SanitizeProto(&proto_); 299 SanitizeProto(&proto_);
290 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); 300 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged());
291 } 301 }
292 302
293 } // namespace internal 303 } // namespace internal
294 } // namespace ash 304 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/power/power_status.h ('k') | ash/system/chromeos/power/tray_power.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698