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

Side by Side Diff: content/renderer/battery_status/battery_status_dispatcher.h

Issue 592153002: Replace Chrome IPC with Mojo IPC for querying BatteryStatus service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tom's comment. Created 6 years, 1 month 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 | « content/renderer/DEPS ('k') | content/renderer/battery_status/battery_status_dispatcher.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 #ifndef CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_
6 #define CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_ 6 #define CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_
7 7
8 #include "content/public/renderer/platform_event_observer.h" 8 #include "base/macros.h"
9 #include "content/common/content_export.h"
10 #include "device/battery/battery_monitor.mojom.h"
9 11
10 namespace blink { 12 namespace blink {
11 class WebBatteryStatus;
12 class WebBatteryStatusListener; 13 class WebBatteryStatusListener;
13 } 14 }
14 15
15 namespace content { 16 namespace content {
16 class RenderThread;
17 17
18 class CONTENT_EXPORT BatteryStatusDispatcher 18 class CONTENT_EXPORT BatteryStatusDispatcher
19 : NON_EXPORTED_BASE( 19 : public NON_EXPORTED_BASE(device::BatteryStatusObserver) {
20 public PlatformEventObserver<blink::WebBatteryStatusListener>) {
21 public: 20 public:
22 explicit BatteryStatusDispatcher(RenderThread* thread); 21 explicit BatteryStatusDispatcher(blink::WebBatteryStatusListener* listener);
23 ~BatteryStatusDispatcher() override; 22 ~BatteryStatusDispatcher() override;
24 23
25 // PlatformEventObserver public methods. 24 private:
26 bool OnControlMessageReceived(const IPC::Message& message) override; 25 // BatteryStatusObserver method.
27 void SendFakeDataForTesting(void* data) override; 26 void DidChange(device::BatteryStatusPtr battery_status) override;
28 27
29 protected: 28 void Start();
30 // PlatformEventObserver protected methods. 29 void Stop();
31 void SendStartMessage() override;
32 void SendStopMessage() override;
33 30
34 private: 31 device::BatteryMonitorPtr monitor_;
35 void OnDidChange(const blink::WebBatteryStatus& status); 32 blink::WebBatteryStatusListener* listener_;
36 33
37 DISALLOW_COPY_AND_ASSIGN(BatteryStatusDispatcher); 34 DISALLOW_COPY_AND_ASSIGN(BatteryStatusDispatcher);
38 }; 35 };
39 36
40 } // namespace content 37 } // namespace content
41 38
42 #endif // CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_ 39 #endif // CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/DEPS ('k') | content/renderer/battery_status/battery_status_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698