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

Side by Side 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: Fixed another bugus assert 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H_
6 #define CONTENT_BROWSER_RENDERER_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/string16.h"
12 #include "content/browser/tab_contents/tab_contents_observer.h"
13
14 #include <map>
jam 2011/10/21 16:18:21 nit: this goes first
15
16 class JavaBridgeDispatcherHost;
17 class RenderViewHost;
18 struct NPObject;
19
20 // This class handles injecting Java objects into all of the RenderViews
21 // associated with a TabContents. It manages a set of JavaBridgeDispatcherHost
22 // objects, one per RenderViewHost.
23 class JavaBridgeDispatcherHostManager : public TabContentsObserver {
24 public:
25 JavaBridgeDispatcherHostManager(TabContents* tab_contents);
26
27 // These methods add or remove the object to each JavaBridgeDispatcherHost.
28 // Each one holds a reference to the NPObject while the object is bound to
29 // the corresponding RenderView. See JavaBridgeDispatcherHost for details.
30 void AddNamedObject(const string16& name, NPObject* object);
31 void RemoveNamedObject(const string16& name);
32
33 // TabContentsObserver overrides
34 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
35 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
36 virtual void TabContentsDestroyed(TabContents* tab_contents) OVERRIDE;
37
38 private:
39 friend class scoped_ptr<JavaBridgeDispatcherHostManager>;
jam 2011/10/21 16:18:21 i haven't seen this pattern before with scoped_ptr
40 virtual ~JavaBridgeDispatcherHostManager();
41
42 typedef std::map<RenderViewHost*, scoped_refptr<JavaBridgeDispatcherHost> >
43 InstanceMap;
44 InstanceMap instances_;
45 typedef std::map<string16, NPObject*> ObjectMap;
46 ObjectMap objects_;
47
48 DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHostManager);
49 };
50
51 #endif // CONTENT_BROWSER_RENDERER_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698