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" |
11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
16 #include "chromeos/dbus/power_manager_client.h" | 16 #include "chromeos/dbus/power_manager_client.h" |
17 #include "grit/ash_resources.h" | 17 #include "grit/ash_resources.h" |
18 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/l10n/time_format.h" | 20 #include "ui/base/l10n/time_format.h" |
21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
23 #include "ui/gfx/image/image_skia_operations.h" | 24 #include "ui/gfx/image/image_skia_operations.h" |
24 #include "ui/gfx/rect.h" | |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Updates |proto| to ensure that its fields are consistent. | 29 // Updates |proto| to ensure that its fields are consistent. |
30 void SanitizeProto(power_manager::PowerSupplyProperties* proto) { | 30 void SanitizeProto(power_manager::PowerSupplyProperties* proto) { |
31 DCHECK(proto); | 31 DCHECK(proto); |
32 | 32 |
33 if (proto->battery_state() == | 33 if (proto->battery_state() == |
34 power_manager::PowerSupplyProperties_BatteryState_FULL) | 34 power_manager::PowerSupplyProperties_BatteryState_FULL) |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 void PowerStatus::PowerChanged( | 297 void PowerStatus::PowerChanged( |
298 const power_manager::PowerSupplyProperties& proto) { | 298 const power_manager::PowerSupplyProperties& proto) { |
299 proto_ = proto; | 299 proto_ = proto; |
300 SanitizeProto(&proto_); | 300 SanitizeProto(&proto_); |
301 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); | 301 FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged()); |
302 } | 302 } |
303 | 303 |
304 } // namespace ash | 304 } // namespace ash |
OLD | NEW |