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

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

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