| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bool PowerStatus::IsMainsChargerConnected() const { | 186 bool PowerStatus::IsMainsChargerConnected() const { |
| 187 return proto_.external_power() == | 187 return proto_.external_power() == |
| 188 power_manager::PowerSupplyProperties_ExternalPower_AC; | 188 power_manager::PowerSupplyProperties_ExternalPower_AC; |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool PowerStatus::IsUsbChargerConnected() const { | 191 bool PowerStatus::IsUsbChargerConnected() const { |
| 192 return proto_.external_power() == | 192 return proto_.external_power() == |
| 193 power_manager::PowerSupplyProperties_ExternalPower_USB; | 193 power_manager::PowerSupplyProperties_ExternalPower_USB; |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool PowerStatus::IsOriginalSpringChargerConnected() const { | |
| 197 return proto_.external_power() == power_manager:: | |
| 198 PowerSupplyProperties_ExternalPower_ORIGINAL_SPRING_CHARGER; | |
| 199 } | |
| 200 | |
| 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 { |
| 209 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 204 all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 210 icon_set == ICON_DARK ? | 205 icon_set == ICON_DARK ? |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 295 } |
| 301 | 296 |
| 302 void PowerStatus::PowerChanged( | 297 void PowerStatus::PowerChanged( |
| 303 const power_manager::PowerSupplyProperties& proto) { | 298 const power_manager::PowerSupplyProperties& proto) { |
| 304 proto_ = proto; | 299 proto_ = proto; |
| 305 SanitizeProto(&proto_); | 300 SanitizeProto(&proto_); |
| 306 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); | 301 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); |
| 307 } | 302 } |
| 308 | 303 |
| 309 } // namespace ash | 304 } // namespace ash |
| OLD | NEW |