| OLD | NEW |
| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 { | 191 bool PowerStatus::IsOriginalSpringChargerConnected() const { |
| 192 // Use the hard coded enum integer value for | 192 return proto_.external_power() == power_manager:: |
| 193 // PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER | 193 PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER; |
| 194 // in purpose of backport compatibility. | |
| 195 // TODO(jennyz): change this to use | |
| 196 // PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER on trunk | |
| 197 // after the change has been merged. | |
| 198 return proto_.external_power() == 3; | |
| 199 } | 194 } |
| 200 | 195 |
| 201 gfx::ImageSkia PowerStatus::GetBatteryImage(IconSet icon_set) const { | 196 gfx::ImageSkia PowerStatus::GetBatteryImage(IconSet icon_set) const { |
| 202 gfx::Image all; | 197 gfx::Image all; |
| 203 if (IsUsbChargerConnected()) { | 198 if (IsUsbChargerConnected()) { |
| 204 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 199 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 205 icon_set == ICON_DARK ? | 200 icon_set == ICON_DARK ? |
| 206 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE_DARK : | 201 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE_DARK : |
| 207 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE); | 202 IDR_AURA_UBER_TRAY_POWER_SMALL_CHARGING_UNRELIABLE); |
| 208 } else { | 203 } else { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 292 |
| 298 void PowerStatus::PowerChanged( | 293 void PowerStatus::PowerChanged( |
| 299 const power_manager::PowerSupplyProperties& proto) { | 294 const power_manager::PowerSupplyProperties& proto) { |
| 300 proto_ = proto; | 295 proto_ = proto; |
| 301 SanitizeProto(&proto_); | 296 SanitizeProto(&proto_); |
| 302 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); | 297 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); |
| 303 } | 298 } |
| 304 | 299 |
| 305 } // namespace internal | 300 } // namespace internal |
| 306 } // namespace ash | 301 } // namespace ash |
| OLD | NEW |