OLD | NEW |
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/child/geofencing/geofencing_message_filter.h" | 5 #include "content/child/navigator_connect/navigator_connect_dispatcher.h" |
6 | 6 |
7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
8 #include "content/child/geofencing/geofencing_dispatcher.h" | 8 #include "content/child/navigator_connect/navigator_connect_provider.h" |
9 #include "content/child/thread_safe_sender.h" | 9 #include "content/child/thread_safe_sender.h" |
10 #include "content/child/worker_thread_task_runner.h" | 10 #include "content/child/worker_thread_task_runner.h" |
11 #include "ipc/ipc_message_macros.h" | 11 #include "content/common/navigator_connect_messages.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 GeofencingMessageFilter::GeofencingMessageFilter(ThreadSafeSender* sender) | 15 NavigatorConnectDispatcher::NavigatorConnectDispatcher(ThreadSafeSender* sender) |
16 : main_thread_loop_proxy_(base::MessageLoopProxy::current()), | 16 : main_thread_loop_proxy_(base::MessageLoopProxy::current()), |
17 thread_safe_sender_(sender) { | 17 thread_safe_sender_(sender) { |
18 } | 18 } |
19 | 19 |
20 GeofencingMessageFilter::~GeofencingMessageFilter() { | 20 NavigatorConnectDispatcher::~NavigatorConnectDispatcher() { |
21 } | 21 } |
22 | 22 |
23 base::TaskRunner* GeofencingMessageFilter::OverrideTaskRunnerForMessage( | 23 base::TaskRunner* NavigatorConnectDispatcher::OverrideTaskRunnerForMessage( |
24 const IPC::Message& msg) { | 24 const IPC::Message& msg) { |
25 if (IPC_MESSAGE_CLASS(msg) != GeofencingMsgStart) | 25 if (IPC_MESSAGE_CLASS(msg) != NavigatorConnectMsgStart) |
26 return NULL; | 26 return NULL; |
27 int ipc_thread_id = 0; | 27 int ipc_thread_id = 0; |
28 const bool success = PickleIterator(msg).ReadInt(&ipc_thread_id); | 28 const bool success = PickleIterator(msg).ReadInt(&ipc_thread_id); |
29 DCHECK(success); | 29 DCHECK(success); |
30 if (!ipc_thread_id) | 30 if (!ipc_thread_id) |
31 return main_thread_loop_proxy_.get(); | 31 return main_thread_loop_proxy_.get(); |
32 return new WorkerThreadTaskRunner(ipc_thread_id); | 32 return new WorkerThreadTaskRunner(ipc_thread_id); |
33 } | 33 } |
34 | 34 |
35 bool GeofencingMessageFilter::OnMessageReceived(const IPC::Message& msg) { | 35 bool NavigatorConnectDispatcher::OnMessageReceived(const IPC::Message& msg) { |
36 if (IPC_MESSAGE_CLASS(msg) != GeofencingMsgStart) | 36 if (IPC_MESSAGE_CLASS(msg) != NavigatorConnectMsgStart) |
37 return false; | 37 return false; |
38 GeofencingDispatcher::GetOrCreateThreadSpecificInstance( | 38 NavigatorConnectProvider::ThreadSpecificInstance(thread_safe_sender_.get()) |
39 thread_safe_sender_.get())->OnMessageReceived(msg); | 39 ->OnMessageReceived(msg); |
40 return true; | 40 return true; |
41 } | 41 } |
42 | 42 |
43 } // namespace content | 43 } // namespace content |
OLD | NEW |