| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/devtools_agent_host_impl.h" | 5 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/stringprintf.h" |
| 8 #include "content/common/devtools_messages.h" | 9 #include "content/common/devtools_messages.h" |
| 9 | 10 |
| 10 namespace content { | 11 namespace content { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 static int g_next_agent_host_id = 0; | 14 static int g_next_agent_host_id = 0; |
| 14 } // namespace | 15 } // namespace |
| 15 | 16 |
| 16 DevToolsAgentHostImpl::DevToolsAgentHostImpl() | 17 DevToolsAgentHostImpl::DevToolsAgentHostImpl() |
| 17 : close_listener_(NULL), | 18 : close_listener_(NULL), |
| 18 id_(++g_next_agent_host_id) { | 19 id_(base::StringPrintf("%d", ++g_next_agent_host_id)) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 void DevToolsAgentHostImpl::Attach() { | 22 void DevToolsAgentHostImpl::Attach() { |
| 22 SendMessageToAgent(new DevToolsAgentMsg_Attach(MSG_ROUTING_NONE)); | 23 SendMessageToAgent(new DevToolsAgentMsg_Attach(MSG_ROUTING_NONE)); |
| 23 NotifyClientAttaching(); | 24 NotifyClientAttaching(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void DevToolsAgentHostImpl::Reattach(const std::string& saved_agent_state) { | 27 void DevToolsAgentHostImpl::Reattach(const std::string& saved_agent_state) { |
| 27 SendMessageToAgent(new DevToolsAgentMsg_Reattach( | 28 SendMessageToAgent(new DevToolsAgentMsg_Reattach( |
| 28 MSG_ROUTING_NONE, | 29 MSG_ROUTING_NONE, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 } | 48 } |
| 48 | 49 |
| 49 void DevToolsAgentHostImpl::AddMessageToConsole(ConsoleMessageLevel level, | 50 void DevToolsAgentHostImpl::AddMessageToConsole(ConsoleMessageLevel level, |
| 50 const std::string& message) { | 51 const std::string& message) { |
| 51 SendMessageToAgent(new DevToolsAgentMsg_AddMessageToConsole( | 52 SendMessageToAgent(new DevToolsAgentMsg_AddMessageToConsole( |
| 52 MSG_ROUTING_NONE, | 53 MSG_ROUTING_NONE, |
| 53 level, | 54 level, |
| 54 message)); | 55 message)); |
| 55 } | 56 } |
| 56 | 57 |
| 58 std::string DevToolsAgentHostImpl::GetId() { |
| 59 return id_; |
| 60 } |
| 61 |
| 57 RenderViewHost* DevToolsAgentHostImpl::GetRenderViewHost() { | 62 RenderViewHost* DevToolsAgentHostImpl::GetRenderViewHost() { |
| 58 return NULL; | 63 return NULL; |
| 59 } | 64 } |
| 60 | 65 |
| 61 void DevToolsAgentHostImpl::NotifyCloseListener() { | 66 void DevToolsAgentHostImpl::NotifyCloseListener() { |
| 62 if (close_listener_) { | 67 if (close_listener_) { |
| 63 scoped_refptr<DevToolsAgentHostImpl> protect(this); | 68 scoped_refptr<DevToolsAgentHostImpl> protect(this); |
| 64 close_listener_->AgentHostClosing(this); | 69 close_listener_->AgentHostClosing(this); |
| 65 close_listener_ = NULL; | 70 close_listener_ = NULL; |
| 66 } | 71 } |
| 67 } | 72 } |
| 68 | 73 |
| 69 } // namespace content | 74 } // namespace content |
| OLD | NEW |