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

Side by Side Diff: content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h

Issue 9251022: Fix JavaBridgeDispatcherHost to use WebContents rather than TabContents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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
« no previous file with comments | « no previous file | content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H _ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H _
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H _ 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_MANAGER_H _
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 15
16 class JavaBridgeDispatcherHost; 16 class JavaBridgeDispatcherHost;
17 class RenderViewHost; 17 class RenderViewHost;
18 struct NPObject; 18 struct NPObject;
19 19
20 // This class handles injecting Java objects into all of the RenderViews 20 // This class handles injecting Java objects into all of the RenderViews
21 // associated with a TabContents. It manages a set of JavaBridgeDispatcherHost 21 // associated with a WebContents. It manages a set of JavaBridgeDispatcherHost
22 // objects, one per RenderViewHost. 22 // objects, one per RenderViewHost.
23 class JavaBridgeDispatcherHostManager : public content::WebContentsObserver { 23 class JavaBridgeDispatcherHostManager : public content::WebContentsObserver {
24 public: 24 public:
25 JavaBridgeDispatcherHostManager(TabContents* tab_contents); 25 JavaBridgeDispatcherHostManager(content::WebContents* web_contents);
26 virtual ~JavaBridgeDispatcherHostManager(); 26 virtual ~JavaBridgeDispatcherHostManager();
27 27
28 // These methods add or remove the object to each JavaBridgeDispatcherHost. 28 // These methods add or remove the object to each JavaBridgeDispatcherHost.
29 // Each one holds a reference to the NPObject while the object is bound to 29 // Each one holds a reference to the NPObject while the object is bound to
30 // the corresponding RenderView. See JavaBridgeDispatcherHost for details. 30 // the corresponding RenderView. See JavaBridgeDispatcherHost for details.
31 void AddNamedObject(const string16& name, NPObject* object); 31 void AddNamedObject(const string16& name, NPObject* object);
32 void RemoveNamedObject(const string16& name); 32 void RemoveNamedObject(const string16& name);
33 33
34 // content::WebContentsObserver overrides 34 // content::WebContentsObserver overrides
35 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; 35 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
36 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; 36 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
37 virtual void WebContentsDestroyed( 37 virtual void WebContentsDestroyed(
38 content::WebContents* tab_contents) OVERRIDE; 38 content::WebContents* web_contents) OVERRIDE;
39 39
40 private: 40 private:
41 typedef std::map<RenderViewHost*, scoped_refptr<JavaBridgeDispatcherHost> > 41 typedef std::map<RenderViewHost*, scoped_refptr<JavaBridgeDispatcherHost> >
42 InstanceMap; 42 InstanceMap;
43 InstanceMap instances_; 43 InstanceMap instances_;
44 typedef std::map<string16, NPObject*> ObjectMap; 44 typedef std::map<string16, NPObject*> ObjectMap;
45 ObjectMap objects_; 45 ObjectMap objects_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHostManager); 47 DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHostManager);
48 }; 48 };
49 49
50 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_MANAGE R_H_ 50 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_MANAGE R_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698