| 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/common/system/chromeos/power/power_status.h" | 5 #include "ash/common/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/resources/vector_icons/vector_icons.h" | 10 #include "ash/resources/vector_icons/vector_icons.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 source.active_by_default() ? DEDICATED_CHARGER : DUAL_ROLE_USB, | 283 source.active_by_default() ? DEDICATED_CHARGER : DUAL_ROLE_USB, |
| 284 PowerSourceToMessageID(source)}); | 284 PowerSourceToMessageID(source)}); |
| 285 } | 285 } |
| 286 return sources; | 286 return sources; |
| 287 } | 287 } |
| 288 | 288 |
| 289 std::string PowerStatus::GetCurrentPowerSourceID() const { | 289 std::string PowerStatus::GetCurrentPowerSourceID() const { |
| 290 return proto_.external_power_source_id(); | 290 return proto_.external_power_source_id(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 PowerStatus::BatteryImageInfo PowerStatus::GetBatteryImageInfo( | 293 PowerStatus::BatteryImageInfo PowerStatus::GetBatteryImageInfo() const { |
| 294 IconSet icon_set) const { | |
| 295 BatteryImageInfo info; | 294 BatteryImageInfo info; |
| 296 CalculateBatteryImageInfo(&info); | 295 CalculateBatteryImageInfo(&info); |
| 297 return info; | 296 return info; |
| 298 } | 297 } |
| 299 | 298 |
| 300 void PowerStatus::CalculateBatteryImageInfo(BatteryImageInfo* info) const { | 299 void PowerStatus::CalculateBatteryImageInfo(BatteryImageInfo* info) const { |
| 301 if (!IsUsbChargerConnected() && !IsBatteryPresent()) { | 300 if (!IsUsbChargerConnected() && !IsBatteryPresent()) { |
| 302 info->icon_badge = &kSystemTrayBatteryXIcon; | 301 info->icon_badge = &kSystemTrayBatteryXIcon; |
| 303 info->charge_level = 0; | 302 info->charge_level = 0; |
| 304 return; | 303 return; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 428 |
| 430 void PowerStatus::PowerChanged( | 429 void PowerStatus::PowerChanged( |
| 431 const power_manager::PowerSupplyProperties& proto) { | 430 const power_manager::PowerSupplyProperties& proto) { |
| 432 proto_ = proto; | 431 proto_ = proto; |
| 433 SanitizeProto(&proto_); | 432 SanitizeProto(&proto_); |
| 434 for (auto& observer : observers_) | 433 for (auto& observer : observers_) |
| 435 observer.OnPowerStatusChanged(); | 434 observer.OnPowerStatusChanged(); |
| 436 } | 435 } |
| 437 | 436 |
| 438 } // namespace ash | 437 } // namespace ash |
| OLD | NEW |