| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 61 |
| 61 void DevToolsAgentHostImpl::NotifyCloseListener() { | 62 void DevToolsAgentHostImpl::NotifyCloseListener() { |
| 62 if (close_listener_) { | 63 if (close_listener_) { |
| 63 scoped_refptr<DevToolsAgentHostImpl> protect(this); | 64 scoped_refptr<DevToolsAgentHostImpl> protect(this); |
| 64 close_listener_->AgentHostClosing(this); | 65 close_listener_->AgentHostClosing(this); |
| 65 close_listener_ = NULL; | 66 close_listener_ = NULL; |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace content | 70 } // namespace content |
| OLD | NEW |