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

Side by Side Diff: content/child/geofencing/geofencing_message_filter.cc

Issue 476293002: Pass through geofencing API calls to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and add region_id sanity check 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/child/geofencing/geofencing_message_filter.h"
6
7 #include "base/message_loop/message_loop_proxy.h"
8 #include "content/child/geofencing/geofencing_dispatcher.h"
9 #include "content/child/thread_safe_sender.h"
10 #include "content/child/worker_thread_task_runner.h"
11 #include "ipc/ipc_message_macros.h"
12
13 namespace content {
14
15 GeofencingMessageFilter::GeofencingMessageFilter(ThreadSafeSender* sender)
16 : main_thread_loop_proxy_(base::MessageLoopProxy::current()),
17 thread_safe_sender_(sender) {
18 }
19
20 GeofencingMessageFilter::~GeofencingMessageFilter() {
21 }
22
23 base::TaskRunner* GeofencingMessageFilter::OverrideTaskRunnerForMessage(
24 const IPC::Message& msg) {
25 if (IPC_MESSAGE_CLASS(msg) != GeofencingMsgStart)
26 return NULL;
27 int ipc_thread_id = 0;
28 const bool success = PickleIterator(msg).ReadInt(&ipc_thread_id);
29 DCHECK(success);
30 if (!ipc_thread_id)
31 return main_thread_loop_proxy_.get();
32 return new WorkerThreadTaskRunner(ipc_thread_id);
33 }
34
35 bool GeofencingMessageFilter::OnMessageReceived(const IPC::Message& msg) {
36 if (IPC_MESSAGE_CLASS(msg) != GeofencingMsgStart)
37 return false;
38 GeofencingDispatcher::GetOrCreateThreadSpecificInstance(
39 thread_safe_sender_.get())->OnMessageReceived(msg);
40 return true;
41 }
42
43 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698