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

Side by Side Diff: content/browser/battery_status/battery_status_manager_chromeos.cc

Issue 634703003: Replacing the OVERRIDE with override and FINAL with final in content/browser/[accessibility|battery… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 "content/browser/battery_status/battery_status_manager.h" 5 #include "content/browser/battery_status/battery_status_manager.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "chromeos/dbus/dbus_thread_manager.h" 8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" 9 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
10 #include "chromeos/dbus/power_manager_client.h" 10 #include "chromeos/dbus/power_manager_client.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
97 if (!currently_listening_) 97 if (!currently_listening_)
98 return; 98 return;
99 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( 99 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
100 this); 100 this);
101 currently_listening_ = false; 101 currently_listening_ = false;
102 } 102 }
103 103
104 // chromeos::PowerManagerClient::Observer: 104 // chromeos::PowerManagerClient::Observer:
105 virtual void PowerChanged( 105 virtual void PowerChanged(
106 const power_manager::PowerSupplyProperties& proto) OVERRIDE { 106 const power_manager::PowerSupplyProperties& proto) override {
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
108 blink::WebBatteryStatus status; 108 blink::WebBatteryStatus status;
109 // Use the default values if there is no battery in the system. 109 // Use the default values if there is no battery in the system.
110 if (IsBatteryPresent(proto)) { 110 if (IsBatteryPresent(proto)) {
111 // The charging status is unreliable if a low power charger is connected 111 // The charging status is unreliable if a low power charger is connected
112 // (i.e. usb). 112 // (i.e. usb).
113 bool status_unreliable = IsUsbChargerConnected(proto); 113 bool status_unreliable = IsUsbChargerConnected(proto);
114 // Battery time is unreliable if it is still being computed. 114 // Battery time is unreliable if it is still being computed.
115 bool time_unreliable = 115 bool time_unreliable =
116 status_unreliable || proto.is_calculating_battery_time(); 116 status_unreliable || proto.is_calculating_battery_time();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 public chromeos::PowerManagerClient::Observer { 149 public chromeos::PowerManagerClient::Observer {
150 public: 150 public:
151 explicit BatteryStatusManagerChromeOS( 151 explicit BatteryStatusManagerChromeOS(
152 const BatteryStatusService::BatteryUpdateCallback& callback) 152 const BatteryStatusService::BatteryUpdateCallback& callback)
153 : observer_(new PowerManagerObserver(callback)) {} 153 : observer_(new PowerManagerObserver(callback)) {}
154 154
155 virtual ~BatteryStatusManagerChromeOS() { observer_->Stop(); } 155 virtual ~BatteryStatusManagerChromeOS() { observer_->Stop(); }
156 156
157 private: 157 private:
158 // BatteryStatusManager: 158 // BatteryStatusManager:
159 virtual bool StartListeningBatteryChange() OVERRIDE { 159 virtual bool StartListeningBatteryChange() override {
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
161 observer_->Start(); 161 observer_->Start();
162 return true; 162 return true;
163 } 163 }
164 164
165 virtual void StopListeningBatteryChange() OVERRIDE { 165 virtual void StopListeningBatteryChange() override {
166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
167 observer_->Stop(); 167 observer_->Stop();
168 } 168 }
169 169
170 scoped_refptr<PowerManagerObserver> observer_; 170 scoped_refptr<PowerManagerObserver> observer_;
171 171
172 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerChromeOS); 172 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerChromeOS);
173 }; 173 };
174 174
175 } // namespace 175 } // namespace
176 176
177 // static 177 // static
178 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( 178 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create(
179 const BatteryStatusService::BatteryUpdateCallback& callback) { 179 const BatteryStatusService::BatteryUpdateCallback& callback) {
180 return scoped_ptr<BatteryStatusManager>( 180 return scoped_ptr<BatteryStatusManager>(
181 new BatteryStatusManagerChromeOS(callback)); 181 new BatteryStatusManagerChromeOS(callback));
182 } 182 }
183 183
184 } // namespace content 184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698