OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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/worker/worker_devtools_agent.h" | |
6 | |
7 #include "content/common/devtools_messages.h" | |
8 #include "content/worker/worker_thread.h" | |
9 #include "ipc/ipc_message.h" | |
10 #include "ipc/ipc_message_macros.h" | |
jam
2011/05/25 17:50:12
no need to include these two ipc headers. they're
yurys
2011/05/26 09:11:49
Done.
| |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | |
jam
2011/05/25 17:50:12
no need?
yurys
2011/05/26 09:11:49
It's used in WorkerDevToolsAgent::SendDevToolsMess
| |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" | |
14 | |
15 using WebKit::WebString; | |
16 using WebKit::WebCString; | |
17 using WebKit::WebWorker; | |
18 | |
19 WorkerDevToolsAgent::WorkerDevToolsAgent(int route_id, WebWorker* webworker) | |
20 : route_id_(route_id) | |
21 , webworker_(webworker) { | |
jam
2011/05/25 17:50:12
comma on previous line
please check the chrome st
yurys
2011/05/26 09:11:49
Yeah, sorry about all these style errors, I defini
| |
22 } | |
23 | |
24 WorkerDevToolsAgent::~WorkerDevToolsAgent() { | |
25 } | |
26 | |
27 // Called on the Worker thread. | |
28 bool WorkerDevToolsAgent::OnMessageReceived(const IPC::Message& message) { | |
29 bool handled = true; | |
30 IPC_BEGIN_MESSAGE_MAP(WorkerDevToolsAgent, message) | |
31 IPC_MESSAGE_HANDLER(WorkerDevToolsAgentMsg_Attach, OnAttach) | |
32 IPC_MESSAGE_HANDLER(WorkerDevToolsAgentMsg_Detach, OnDetach) | |
33 IPC_MESSAGE_HANDLER(WorkerDevToolsAgentMsg_DispatchOnInspectorBackend, | |
34 OnDispatchOnInspectorBackend) | |
35 IPC_MESSAGE_UNHANDLED(handled = false) | |
36 IPC_END_MESSAGE_MAP() | |
37 return handled; | |
38 } | |
39 | |
40 void WorkerDevToolsAgent::OnAttach() { | |
41 webworker_->attachDevTools(); | |
42 } | |
43 | |
44 void WorkerDevToolsAgent::OnDetach() { | |
45 webworker_->detachDevTools(); | |
46 } | |
47 | |
48 void WorkerDevToolsAgent::OnDispatchOnInspectorBackend( | |
49 const std::string& message) { | |
50 webworker_->dispatchDevToolsMessage(WebString::fromUTF8(message)); | |
51 } | |
52 | |
53 bool WorkerDevToolsAgent::Send(IPC::Message* message) { | |
54 return WorkerThread::current()->Send(message); | |
55 } | |
56 | |
57 void WorkerDevToolsAgent::SendDevToolsMessage(const WebString& message) | |
58 { | |
jam
2011/05/25 17:50:12
nit: brace bracket on previous line
yurys
2011/05/26 09:11:49
Done.
| |
59 Send(new DevToolsAgentMsg_DispatchMessageFromWorker(route_id_, | |
60 message.utf8())); | |
61 } | |
OLD | NEW |