Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: device/battery/battery_status_manager_chromeos.cc

Issue 2801173004: Add '.mojom' suffix for battery mojom modules. (Closed)
Patch Set: Rebase only Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/battery/battery_status.mojom ('k') | device/battery/battery_status_manager_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/battery/battery_status_manager.h" 5 #include "device/battery/battery_status_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 double GetBatteryLevel( 75 double GetBatteryLevel(
76 const power_manager::PowerSupplyProperties& proto) const { 76 const power_manager::PowerSupplyProperties& proto) const {
77 const double kMaxBatteryLevelProto = 100.f; 77 const double kMaxBatteryLevelProto = 100.f;
78 return proto.battery_percent() / kMaxBatteryLevelProto; 78 return proto.battery_percent() / kMaxBatteryLevelProto;
79 } 79 }
80 80
81 // chromeos::PowerManagerClient::Observer: 81 // chromeos::PowerManagerClient::Observer:
82 void PowerChanged( 82 void PowerChanged(
83 const power_manager::PowerSupplyProperties& proto) override { 83 const power_manager::PowerSupplyProperties& proto) override {
84 BatteryStatus status; 84 mojom::BatteryStatus status;
85 85
86 // Use the default values if there is no battery in the system. 86 // Use the default values if there is no battery in the system.
87 if (IsBatteryPresent(proto)) { 87 if (IsBatteryPresent(proto)) {
88 // The charging status is unreliable if a low power charger is connected 88 // The charging status is unreliable if a low power charger is connected
89 // (i.e. usb). 89 // (i.e. usb).
90 bool status_unreliable = IsUsbChargerConnected(proto); 90 bool status_unreliable = IsUsbChargerConnected(proto);
91 // Battery time is unreliable if it is still being computed. 91 // Battery time is unreliable if it is still being computed.
92 bool time_unreliable = 92 bool time_unreliable =
93 status_unreliable || proto.is_calculating_battery_time(); 93 status_unreliable || proto.is_calculating_battery_time();
94 94
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } // namespace 148 } // namespace
149 149
150 // static 150 // static
151 std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create( 151 std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create(
152 const BatteryStatusService::BatteryUpdateCallback& callback) { 152 const BatteryStatusService::BatteryUpdateCallback& callback) {
153 return std::unique_ptr<BatteryStatusManager>( 153 return std::unique_ptr<BatteryStatusManager>(
154 new BatteryStatusManagerChromeOS(callback)); 154 new BatteryStatusManagerChromeOS(callback));
155 } 155 }
156 156
157 } // namespace device 157 } // namespace device
OLDNEW
« no previous file with comments | « device/battery/battery_status.mojom ('k') | device/battery/battery_status_manager_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698