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

Side by Side Diff: content/child/navigator_connect/navigator_connect_dispatcher.cc

Issue 781723002: Pass navigator.connect calls through to the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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/navigator_connect/navigator_connect_dispatcher.h"
6
7 #include "base/message_loop/message_loop_proxy.h"
8 #include "content/child/navigator_connect/navigator_connect_provider.h"
9 #include "content/child/thread_safe_sender.h"
10 #include "content/child/worker_thread_task_runner.h"
11 #include "content/common/navigator_connect_messages.h"
12
13 namespace content {
14
15 NavigatorConnectDispatcher::NavigatorConnectDispatcher(ThreadSafeSender* sender)
16 : main_thread_loop_proxy_(base::MessageLoopProxy::current()),
17 thread_safe_sender_(sender) {
18 }
19
20 NavigatorConnectDispatcher::~NavigatorConnectDispatcher() {
21 }
22
23 base::TaskRunner* NavigatorConnectDispatcher::OverrideTaskRunnerForMessage(
24 const IPC::Message& msg) {
25 if (IPC_MESSAGE_CLASS(msg) != NavigatorConnectMsgStart)
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 NavigatorConnectDispatcher::OnMessageReceived(const IPC::Message& msg) {
36 bool handled = true;
37 IPC_BEGIN_MESSAGE_MAP(NavigatorConnectDispatcher, msg)
38 IPC_MESSAGE_FORWARD(NavigatorConnectMsg_ConnectResult,
scheib 2014/12/05 05:49:50 Why not the pattern as in GeofencingMessageFilter,
Marijn Kruisselbrink 2014/12/05 14:25:50 No functional difference, no. Just saving some lin
39 NavigatorConnectProvider::ThreadSpecificInstance(
40 thread_safe_sender_.get()),
41 NavigatorConnectProvider::OnConnectResult)
42 IPC_MESSAGE_UNHANDLED(handled = false)
43 IPC_END_MESSAGE_MAP()
44 return handled;
45 }
46
47 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698