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

Unified Diff: content/browser/renderer_host/java_bridge_dispatcher_host_manager.h

Issue 8366034: Adds browser-side component of Java Bridge for a TabContents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Guards with ENABLE_JAVA_BRIDGE and addresses other comments Created 9 years, 2 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 | « no previous file | content/browser/renderer_host/java_bridge_dispatcher_host_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/java_bridge_dispatcher_host_manager.h
diff --git a/content/browser/renderer_host/java_bridge_dispatcher_host_manager.h b/content/browser/renderer_host/java_bridge_dispatcher_host_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6e564958f2c091b4e45ae2f42ace5b59f509e84
--- /dev/null
+++ b/content/browser/renderer_host/java_bridge_dispatcher_host_manager.h
@@ -0,0 +1,49 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_RENDERER_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H_
+#define CONTENT_BROWSER_RENDERER_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H_
+#pragma once
+
+#include <map>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/string16.h"
+#include "content/browser/tab_contents/tab_contents_observer.h"
+
+class JavaBridgeDispatcherHost;
+class RenderViewHost;
+struct NPObject;
+
+// This class handles injecting Java objects into all of the RenderViews
+// associated with a TabContents. It manages a set of JavaBridgeDispatcherHost
+// objects, one per RenderViewHost.
+class JavaBridgeDispatcherHostManager : public TabContentsObserver {
+ public:
+ JavaBridgeDispatcherHostManager(TabContents* tab_contents);
+ virtual ~JavaBridgeDispatcherHostManager();
+
+ // These methods add or remove the object to each JavaBridgeDispatcherHost.
+ // Each one holds a reference to the NPObject while the object is bound to
+ // the corresponding RenderView. See JavaBridgeDispatcherHost for details.
+ void AddNamedObject(const string16& name, NPObject* object);
+ void RemoveNamedObject(const string16& name);
+
+ // TabContentsObserver overrides
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void TabContentsDestroyed(TabContents* tab_contents) OVERRIDE;
+
+ private:
+ typedef std::map<RenderViewHost*, scoped_refptr<JavaBridgeDispatcherHost> >
+ InstanceMap;
+ InstanceMap instances_;
+ typedef std::map<string16, NPObject*> ObjectMap;
+ ObjectMap objects_;
+
+ DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHostManager);
+};
+
+#endif // CONTENT_BROWSER_RENDERER_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H_
« no previous file with comments | « no previous file | content/browser/renderer_host/java_bridge_dispatcher_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698