blob: 35111e9ab828725fc87f5be413cc13db19866c65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/devtools/devtools_agent_host_impl.h"
#include <map>
#include "base/basictypes.h"
#include "base/guid.h"
#include "base/lazy_instance.h"
#include "content/browser/devtools/devtools_manager_impl.h"
namespace content {
namespace {
typedef std::map<std::string, DevToolsAgentHostImpl*> Instances;
base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER;
} // namespace
DevToolsAgentHostImpl::DevToolsAgentHostImpl()
: close_listener_(NULL),
id_(base::GenerateGUID()) {
g_instances.Get()[id_] = this;
}
DevToolsAgentHostImpl::~DevToolsAgentHostImpl() {
g_instances.Get().erase(g_instances.Get().find(id_));
}
scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForId(
const std::string& id) {
if (g_instances == NULL)
return NULL;
Instances::iterator it = g_instances.Get().find(id);
if (it == g_instances.Get().end())
return NULL;
return it->second;
}
bool DevToolsAgentHostImpl::IsAttached() {
return !!DevToolsManagerImpl::GetInstance()->GetDevToolsClientHostFor(this);
}
void DevToolsAgentHostImpl::InspectElement(int x, int y) {
}
std::string DevToolsAgentHostImpl::GetId() {
return id_;
}
RenderViewHost* DevToolsAgentHostImpl::GetRenderViewHost() {
return NULL;
}
void DevToolsAgentHostImpl::DisconnectRenderViewHost() {}
void DevToolsAgentHostImpl::ConnectRenderViewHost(RenderViewHost* rvh) {}
void DevToolsAgentHostImpl::NotifyCloseListener() {
if (close_listener_) {
scoped_refptr<DevToolsAgentHostImpl> protect(this);
close_listener_->AgentHostClosing(this);
close_listener_ = NULL;
}
}
} // namespace content
|