#ifndef CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_
#define CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_
#include "components/plugins/renderer/plugin_placeholder.h"
struct ChromeViewHostMsg_GetPluginInfo_Status;
class ChromePluginPlaceholder : public plugins::PluginPlaceholder,
                                public content::RenderProcessObserver,
                                public content::ContextMenuClient {
 public:
  static const char kPluginPlaceholderDataURL[];
  static ChromePluginPlaceholder* CreateBlockedPlugin(
      content::RenderFrame* render_frame,
      blink::WebFrame* frame,
      const blink::WebPluginParams& params,
      const content::WebPluginInfo& info,
      const std::string& identifier,
      const base::string16& name,
      int resource_id,
      const base::string16& message);
  
  static ChromePluginPlaceholder* CreateMissingPlugin(
      content::RenderFrame* render_frame,
      blink::WebFrame* frame,
      const blink::WebPluginParams& params);
  static ChromePluginPlaceholder* CreateErrorPlugin(
      content::RenderFrame* render_frame,
      const base::FilePath& plugin_path);
  void SetStatus(const ChromeViewHostMsg_GetPluginInfo_Status& status);
#if defined(ENABLE_PLUGIN_INSTALLATION)
  int32 CreateRoutingId();
#endif
 private:
  ChromePluginPlaceholder(content::RenderFrame* render_frame,
                          blink::WebFrame* frame,
                          const blink::WebPluginParams& params,
                          const std::string& html_data,
                          const base::string16& title);
  virtual ~ChromePluginPlaceholder();
  
  virtual void BindWebFrame(blink::WebFrame* frame) OVERRIDE;
  
  virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
      v8::Isolate* isolate) OVERRIDE;
  
  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
  
  virtual void ShowContextMenu(const blink::WebMouseEvent&) OVERRIDE;
  
  virtual void PluginListChanged() OVERRIDE;
  
  virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE;
  virtual void OnMenuClosed(int request_id) OVERRIDE;
  
  void OpenAboutPluginsCallback();
  void OnLoadBlockedPlugins(const std::string& identifier);
  void OnSetIsPrerendering(bool is_prerendering);
#if defined(ENABLE_PLUGIN_INSTALLATION)
  void OnDidNotFindMissingPlugin();
  void OnFoundMissingPlugin(const base::string16& plugin_name);
  void OnStartedDownloadingPlugin();
  void OnFinishedDownloadingPlugin();
  void OnErrorDownloadingPlugin(const std::string& error);
  void OnCancelledDownloadingPlugin();
#endif
  
  
  scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_;
  base::string16 title_;
#if defined(ENABLE_PLUGIN_INSTALLATION)
  
  
  int32 placeholder_routing_id_;
#endif
  bool has_host_;
  int context_menu_request_id_;  
  base::string16 plugin_name_;
  DISALLOW_COPY_AND_ASSIGN(ChromePluginPlaceholder);
};
#endif