Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1733)

Unified Diff: content/browser/debugger/render_view_devtools_agent_host.cc

Issue 7778001: DevTools: introduce DevToolsAgentHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/debugger/render_view_devtools_agent_host.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/debugger/render_view_devtools_agent_host.cc
diff --git a/content/browser/debugger/render_view_devtools_agent_host.cc b/content/browser/debugger/render_view_devtools_agent_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..47517e42ddaf214af02a47436579b1aab7d6dbe1
--- /dev/null
+++ b/content/browser/debugger/render_view_devtools_agent_host.cc
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 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/debugger/render_view_devtools_agent_host.h"
+
+#include "base/basictypes.h"
+#include "content/browser/renderer_host/render_process_host.h"
+#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/site_instance.h"
+#include "content/common/notification_service.h"
+
+RenderViewDevToolsAgentHost::Instances RenderViewDevToolsAgentHost::instances_;
+
+DevToolsAgentHost* RenderViewDevToolsAgentHost::FindFor(
+ RenderViewHost* rvh) {
+ Instances::iterator it = instances_.find(rvh);
+ if (it != instances_.end())
+ return it->second;
+ return new RenderViewDevToolsAgentHost(rvh);
+}
+
+RenderViewDevToolsAgentHost::RenderViewDevToolsAgentHost(RenderViewHost* rvh)
+ : render_view_host_(rvh) {
+ registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
+ Source<RenderViewHost>(rvh));
+ instances_[rvh] = this;
+}
+
+void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) {
+ msg->set_routing_id(render_view_host_->routing_id());
+ render_view_host_->Send(msg);
+}
+
+void RenderViewDevToolsAgentHost::NotifyClientClosing() {
+ NotificationService::current()->Notify(
+ content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
+ Source<content::BrowserContext>(
+ render_view_host_->site_instance()->GetProcess()->browser_context()),
+ Details<RenderViewHost>(render_view_host_));
+}
+
+int RenderViewDevToolsAgentHost::GetRenderProcessId() {
+ return render_view_host_->process()->id();
+}
+
+void RenderViewDevToolsAgentHost::Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_DELETED);
+ NotifyCloseListener();
+ delete this;
+}
+
+RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() {
+ instances_.erase(render_view_host_);
+}
+
« no previous file with comments | « content/browser/debugger/render_view_devtools_agent_host.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698