| 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/browser/devtools/ipc_devtools_agent_host.h" | 5 #include "content/browser/devtools/ipc_devtools_agent_host.h" | 
| 6 | 6 | 
|  | 7 #include "content/browser/devtools/service_worker_devtools_agent_host.h" | 
|  | 8 #include "content/browser/devtools/service_worker_devtools_manager.h" | 
|  | 9 | 
| 7 namespace content { | 10 namespace content { | 
| 8 | 11 | 
| 9 void IPCDevToolsAgentHost::Attach() { | 12 void IPCDevToolsAgentHost::Attach() { | 
| 10   SendMessageToAgent(new DevToolsAgentMsg_Attach(MSG_ROUTING_NONE, GetId())); | 13   SendMessageToAgent(new DevToolsAgentMsg_Attach(MSG_ROUTING_NONE, GetId())); | 
| 11   OnClientAttached(); | 14   OnClientAttached(); | 
| 12 } | 15 } | 
| 13 | 16 | 
| 14 void IPCDevToolsAgentHost::Detach() { | 17 void IPCDevToolsAgentHost::Detach() { | 
| 15   SendMessageToAgent(new DevToolsAgentMsg_Detach(MSG_ROUTING_NONE)); | 18   SendMessageToAgent(new DevToolsAgentMsg_Detach(MSG_ROUTING_NONE)); | 
| 16   OnClientDetached(); | 19   OnClientDetached(); | 
| 17 } | 20 } | 
| 18 | 21 | 
| 19 bool IPCDevToolsAgentHost::DispatchProtocolMessage( | 22 bool IPCDevToolsAgentHost::DispatchProtocolMessage( | 
| 20     const std::string& message) { | 23     const std::string& message) { | 
| 21   if (DevToolsAgentHostImpl::DispatchProtocolMessage(message)) | 24   if (DevToolsAgentHostImpl::DispatchProtocolMessage(message)) | 
| 22     return true; | 25     return true; | 
| 23 | 26 | 
| 24   SendMessageToAgent(new DevToolsAgentMsg_DispatchOnInspectorBackend( | 27   SendMessageToAgent(new DevToolsAgentMsg_DispatchOnInspectorBackend( | 
| 25       MSG_ROUTING_NONE, message)); | 28       MSG_ROUTING_NONE, message)); | 
| 26   return true; | 29   return true; | 
| 27 } | 30 } | 
| 28 | 31 | 
| 29 void IPCDevToolsAgentHost::InspectElement(int x, int y) { | 32 void IPCDevToolsAgentHost::InspectElement(int x, int y) { | 
| 30   SendMessageToAgent(new DevToolsAgentMsg_InspectElement(MSG_ROUTING_NONE, | 33   SendMessageToAgent(new DevToolsAgentMsg_InspectElement(MSG_ROUTING_NONE, | 
| 31                                                          GetId(), x, y)); | 34                                                          GetId(), x, y)); | 
| 32 } | 35 } | 
| 33 | 36 | 
|  | 37 void IPCDevToolsAgentHost::OpenWorkerInspector(BrowserContext* context, | 
|  | 38                                                const std::string& id) { | 
|  | 39   ServiceWorkerDevToolsAgentHost::List agent_hosts; | 
|  | 40   ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&agent_hosts); | 
|  | 41   for (auto host : agent_hosts) { | 
|  | 42     if (host->GetId() == id) { | 
|  | 43       host->Inspect(context); | 
|  | 44       return; | 
|  | 45     } | 
|  | 46   } | 
|  | 47 } | 
|  | 48 | 
| 34 IPCDevToolsAgentHost::IPCDevToolsAgentHost() | 49 IPCDevToolsAgentHost::IPCDevToolsAgentHost() | 
| 35     : message_buffer_size_(0) { | 50     : message_buffer_size_(0) { | 
| 36 } | 51 } | 
| 37 | 52 | 
| 38 IPCDevToolsAgentHost::~IPCDevToolsAgentHost() { | 53 IPCDevToolsAgentHost::~IPCDevToolsAgentHost() { | 
| 39 } | 54 } | 
| 40 | 55 | 
| 41 void IPCDevToolsAgentHost::Reattach() { | 56 void IPCDevToolsAgentHost::Reattach() { | 
| 42   SendMessageToAgent(new DevToolsAgentMsg_Reattach( | 57   SendMessageToAgent(new DevToolsAgentMsg_Reattach( | 
| 43       MSG_ROUTING_NONE, GetId(), state_cookie_)); | 58       MSG_ROUTING_NONE, GetId(), state_cookie_)); | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 67 | 82 | 
| 68   if (chunk.is_last) { | 83   if (chunk.is_last) { | 
| 69     CHECK(message_buffer_.size() == message_buffer_size_); | 84     CHECK(message_buffer_.size() == message_buffer_size_); | 
| 70     SendMessageToClient(message_buffer_); | 85     SendMessageToClient(message_buffer_); | 
| 71     message_buffer_ = std::string(); | 86     message_buffer_ = std::string(); | 
| 72     message_buffer_size_ = 0; | 87     message_buffer_size_ = 0; | 
| 73   } | 88   } | 
| 74 } | 89 } | 
| 75 | 90 | 
| 76 }  // namespace content | 91 }  // namespace content | 
| OLD | NEW | 
|---|