blob: fde0c47d049fafde5a1e4fd5973c33de224eded2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
#define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
#pragma once
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
#include "webkit/glue/cpp_bound_class.h"
#include "webkit/plugins/webview_plugin.h"
namespace webkit {
struct WebPluginInfo;
}
// Base class to share code between different plug-in placeholders
// used in Chrome. Placeholders can be used if a plug-in is missing or not
// available (blocked or disabled).
class PluginPlaceholder : public content::RenderViewObserver,
public CppBoundClass,
public webkit::WebViewPlugin::Delegate {
protected:
// |render_view| and |frame| are weak pointers. If either one is going away,
// our |plugin_| will be destroyed as well and will notify us.
PluginPlaceholder(content::RenderView* render_view,
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params,
const std::string& html_data);
virtual ~PluginPlaceholder();
webkit::WebViewPlugin* plugin() { return plugin_; }
WebKit::WebFrame* frame() { return frame_; }
// Can be called by a subclass to replace this placeholder with an actual
// plugin from |plugin_info|.
void LoadPluginInternal(const webkit::WebPluginInfo& plugin_info);
// WebViewPlugin::Delegate methods:
// Can be called by a subclass to hide this placeholder.
void HidePluginInternal();
virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE;
virtual void WillDestroyPlugin() OVERRIDE;
virtual void ShowContextMenu(const WebKit::WebMouseEvent& event) OVERRIDE;
virtual void DidFinishLoading() OVERRIDE;
private:
WebKit::WebFrame* frame_;
WebKit::WebPluginParams plugin_params_;
webkit::WebViewPlugin* plugin_;
DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
};
#endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
|