Version 7 golden file for safe-browsing test.
[chromium-blink-merge.git] / chrome / renderer / plugins / chrome_plugin_placeholder.h
blobd7d1d81e2e10b9ea0b1d59a3398a63f8bd19bf43
1 // Copyright 2013 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.
5 #ifndef CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_
6 #define CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_
8 #include "components/plugins/renderer/plugin_placeholder.h"
10 struct ChromeViewHostMsg_GetPluginInfo_Status;
12 class ChromePluginPlaceholder : public plugins::PluginPlaceholder,
13 public content::RenderProcessObserver,
14 public content::ContextMenuClient {
15 public:
16 static const char kPluginPlaceholderDataURL[];
18 static ChromePluginPlaceholder* CreateBlockedPlugin(
19 content::RenderFrame* render_frame,
20 blink::WebFrame* frame,
21 const blink::WebPluginParams& params,
22 const content::WebPluginInfo& info,
23 const std::string& identifier,
24 const base::string16& name,
25 int resource_id,
26 const base::string16& message);
28 // Creates a new WebViewPlugin with a MissingPlugin as a delegate.
29 static ChromePluginPlaceholder* CreateMissingPlugin(
30 content::RenderFrame* render_frame,
31 blink::WebFrame* frame,
32 const blink::WebPluginParams& params);
34 static ChromePluginPlaceholder* CreateErrorPlugin(
35 content::RenderFrame* render_frame,
36 const base::FilePath& plugin_path);
38 void SetStatus(const ChromeViewHostMsg_GetPluginInfo_Status& status);
40 #if defined(ENABLE_PLUGIN_INSTALLATION)
41 int32 CreateRoutingId();
42 #endif
44 private:
45 ChromePluginPlaceholder(content::RenderFrame* render_frame,
46 blink::WebFrame* frame,
47 const blink::WebPluginParams& params,
48 const std::string& html_data,
49 const base::string16& title);
50 virtual ~ChromePluginPlaceholder();
52 // WebViewPlugin::Delegate (via PluginPlaceholder) method
53 virtual void BindWebFrame(blink::WebFrame* frame) OVERRIDE;
55 // gin::Wrappable (via PluginPlaceholder) method
56 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
57 v8::Isolate* isolate) OVERRIDE;
59 // content::RenderViewObserver (via PluginPlaceholder) override:
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
62 // WebViewPlugin::Delegate (via PluginPlaceholder) methods:
63 virtual void ShowContextMenu(const blink::WebMouseEvent&) OVERRIDE;
65 // content::RenderProcessObserver methods:
66 virtual void PluginListChanged() OVERRIDE;
68 // content::ContextMenuClient methods:
69 virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE;
70 virtual void OnMenuClosed(int request_id) OVERRIDE;
72 // Javascript callback opens chrome://plugins in a new tab.
73 void OpenAboutPluginsCallback();
75 void OnLoadBlockedPlugins(const std::string& identifier);
76 void OnSetIsPrerendering(bool is_prerendering);
77 #if defined(ENABLE_PLUGIN_INSTALLATION)
78 void OnDidNotFindMissingPlugin();
79 void OnFoundMissingPlugin(const base::string16& plugin_name);
80 void OnStartedDownloadingPlugin();
81 void OnFinishedDownloadingPlugin();
82 void OnErrorDownloadingPlugin(const std::string& error);
83 void OnCancelledDownloadingPlugin();
84 #endif
86 // We use a scoped_ptr so we can forward-declare the struct; it's defined in
87 // an IPC message file which can't be easily included in other header files.
88 scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_;
90 base::string16 title_;
92 #if defined(ENABLE_PLUGIN_INSTALLATION)
93 // |routing_id()| is the routing ID of our associated RenderView, but we have
94 // a separate routing ID for messages specific to this placeholder.
95 int32 placeholder_routing_id_;
96 #endif
98 bool has_host_;
99 int context_menu_request_id_; // Nonzero when request pending.
100 base::string16 plugin_name_;
102 DISALLOW_COPY_AND_ASSIGN(ChromePluginPlaceholder);
105 #endif // CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_