| 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/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 const bool use_alert_color = | 399 const bool use_alert_color = |
| 400 (info.charge_level == kMinVisualChargeLevelMd && !IsLinePowerConnected()); | 400 (info.charge_level == kMinVisualChargeLevelMd && !IsLinePowerConnected()); |
| 401 const SkColor badge_color = | 401 const SkColor badge_color = |
| 402 use_alert_color ? kBatteryAlertColor : kBatteryBadgeColor; | 402 use_alert_color ? kBatteryAlertColor : kBatteryBadgeColor; |
| 403 const SkColor charge_color = | 403 const SkColor charge_color = |
| 404 use_alert_color ? kBatteryAlertColor : kBatteryChargeColor; | 404 use_alert_color ? kBatteryAlertColor : kBatteryChargeColor; |
| 405 gfx::Canvas canvas( | 405 gfx::Canvas canvas( |
| 406 gfx::Size(kBatteryCanvasSizeMd, kBatteryCanvasSizeMd), | 406 gfx::Size(kBatteryCanvasSizeMd, kBatteryCanvasSizeMd), |
| 407 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(), | 407 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(), |
| 408 true); | 408 false); |
| 409 | 409 |
| 410 // Paint the battery's base (background) color. | 410 // Paint the battery's base (background) color. |
| 411 PaintVectorIcon(&canvas, gfx::VectorIconId::SYSTEM_TRAY_BATTERY, | 411 PaintVectorIcon(&canvas, gfx::VectorIconId::SYSTEM_TRAY_BATTERY, |
| 412 kBatteryCanvasSizeMd, kBatteryBaseColor); | 412 kBatteryCanvasSizeMd, kBatteryBaseColor); |
| 413 | 413 |
| 414 // Paint the charged portion of the battery. Note that |charge_height| adjusts | 414 // Paint the charged portion of the battery. Note that |charge_height| adjusts |
| 415 // for the 2dp of padding between the bottom of the battery icon and the | 415 // for the 2dp of padding between the bottom of the battery icon and the |
| 416 // bottom edge of |canvas|. | 416 // bottom edge of |canvas|. |
| 417 const int charge_height = info.charge_level + 2; | 417 const int charge_height = info.charge_level + 2; |
| 418 gfx::Rect clip_rect(0, kBatteryCanvasSizeMd - charge_height, | 418 gfx::Rect clip_rect(0, kBatteryCanvasSizeMd - charge_height, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } | 507 } |
| 508 | 508 |
| 509 void PowerStatus::PowerChanged( | 509 void PowerStatus::PowerChanged( |
| 510 const power_manager::PowerSupplyProperties& proto) { | 510 const power_manager::PowerSupplyProperties& proto) { |
| 511 proto_ = proto; | 511 proto_ = proto; |
| 512 SanitizeProto(&proto_); | 512 SanitizeProto(&proto_); |
| 513 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); | 513 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace ash | 516 } // namespace ash |
| OLD | NEW |