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 "content/child/power_monitor_broadcast_source.h" | 5 #include "content/child/power_monitor_broadcast_source.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "content/common/power_monitor_messages.h" | 8 #include "content/common/power_monitor_messages.h" |
9 #include "ipc/message_filter.h" | 9 #include "ipc/message_filter.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 class PowerMessageFilter : public IPC::MessageFilter { | 13 class PowerMessageFilter : public IPC::MessageFilter { |
14 public: | 14 public: |
15 PowerMessageFilter( | 15 PowerMessageFilter( |
16 PowerMonitorBroadcastSource* source, | 16 PowerMonitorBroadcastSource* source, |
17 scoped_refptr<base::MessageLoopProxy> message_loop) | 17 scoped_refptr<base::MessageLoopProxy> message_loop) |
18 : source_(source), | 18 : source_(source), |
19 message_loop_(message_loop) { | 19 message_loop_(message_loop) { |
20 } | 20 } |
21 | 21 |
22 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 22 virtual bool OnMessageReceived(const IPC::Message& message) override { |
23 bool handled = true; | 23 bool handled = true; |
24 IPC_BEGIN_MESSAGE_MAP(PowerMessageFilter, message) | 24 IPC_BEGIN_MESSAGE_MAP(PowerMessageFilter, message) |
25 IPC_MESSAGE_HANDLER(PowerMonitorMsg_PowerStateChange, OnPowerStateChange) | 25 IPC_MESSAGE_HANDLER(PowerMonitorMsg_PowerStateChange, OnPowerStateChange) |
26 IPC_MESSAGE_HANDLER(PowerMonitorMsg_Suspend, OnSuspend) | 26 IPC_MESSAGE_HANDLER(PowerMonitorMsg_Suspend, OnSuspend) |
27 IPC_MESSAGE_HANDLER(PowerMonitorMsg_Resume, OnResume) | 27 IPC_MESSAGE_HANDLER(PowerMonitorMsg_Resume, OnResume) |
28 IPC_MESSAGE_UNHANDLED(handled = false) | 28 IPC_MESSAGE_UNHANDLED(handled = false) |
29 IPC_END_MESSAGE_MAP() | 29 IPC_END_MESSAGE_MAP() |
30 return handled; | 30 return handled; |
31 } | 31 } |
32 | 32 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 void PowerMonitorBroadcastSource::OnSuspend() { | 100 void PowerMonitorBroadcastSource::OnSuspend() { |
101 ProcessPowerEvent(PowerMonitorSource::SUSPEND_EVENT); | 101 ProcessPowerEvent(PowerMonitorSource::SUSPEND_EVENT); |
102 } | 102 } |
103 | 103 |
104 void PowerMonitorBroadcastSource::OnResume() { | 104 void PowerMonitorBroadcastSource::OnResume() { |
105 ProcessPowerEvent(PowerMonitorSource::RESUME_EVENT); | 105 ProcessPowerEvent(PowerMonitorSource::RESUME_EVENT); |
106 } | 106 } |
107 | 107 |
108 } // namespace content | 108 } // namespace content |
OLD | NEW |