#ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_DISPATCHER_HOST_H_
#include <vector>
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "content/child/npapi/npobject_stub.h"
class RouteIDGenerator;
struct NPObject;
namespace IPC {
class Message;
}
namespace content {
class NPChannelBase;
class RenderFrameHost;
struct NPVariant_Param;
class JavaBridgeDispatcherHost
: public base::RefCountedThreadSafe<JavaBridgeDispatcherHost> {
public:
explicit JavaBridgeDispatcherHost(RenderFrameHost* render_frame_host);
void AddNamedObject(const base::string16& name, NPObject* object);
void RemoveNamedObject(const base::string16& name);
void RenderFrameDeleted();
void OnGetChannelHandle(IPC::Message* reply_msg);
private:
friend class base::RefCountedThreadSafe<JavaBridgeDispatcherHost>;
virtual ~JavaBridgeDispatcherHost();
void Send(IPC::Message* msg);
void GetChannelHandle(IPC::Message* reply_msg);
void CreateNPVariantParam(NPObject* object, NPVariant_Param* param);
void CreateObjectStub(NPObject* object, int render_process_id, int route_id);
scoped_refptr<NPChannelBase> channel_;
RenderFrameHost* render_frame_host_;
std::vector<base::WeakPtr<NPObjectStub> > stubs_;
DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHost);
};
}
#endif