2015-09-09 16:05:39 +02:00
|
|
|
// Copyright 2013 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 CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
|
|
|
#define CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
|
|
|
|
2016-01-06 20:20:54 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "base/macros.h"
|
|
|
|
#include "chrome/renderer/plugins/power_saver_info.h"
|
2015-09-09 16:05:39 +02:00
|
|
|
#include "components/plugins/renderer/loadable_plugin_placeholder.h"
|
|
|
|
#include "content/public/renderer/context_menu_client.h"
|
2016-05-25 01:35:43 +02:00
|
|
|
#include "content/public/renderer/render_thread_observer.h"
|
2015-09-09 16:05:39 +02:00
|
|
|
|
|
|
|
enum class CefViewHostMsg_GetPluginInfo_Status;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
class CefPluginPlaceholder final : public plugins::LoadablePluginPlaceholder,
|
|
|
|
public content::RenderThreadObserver,
|
|
|
|
public content::ContextMenuClient,
|
|
|
|
public gin::Wrappable<CefPluginPlaceholder> {
|
2015-09-09 16:05:39 +02:00
|
|
|
public:
|
|
|
|
static gin::WrapperInfo kWrapperInfo;
|
|
|
|
|
|
|
|
static CefPluginPlaceholder* CreateBlockedPlugin(
|
|
|
|
content::RenderFrame* render_frame,
|
|
|
|
const blink::WebPluginParams& params,
|
|
|
|
const content::WebPluginInfo& info,
|
|
|
|
const std::string& identifier,
|
|
|
|
const base::string16& name,
|
|
|
|
int resource_id,
|
|
|
|
const base::string16& message,
|
2016-01-06 20:20:54 +01:00
|
|
|
const PowerSaverInfo& power_saver_info);
|
2015-09-09 16:05:39 +02:00
|
|
|
|
|
|
|
// Creates a new WebViewPlugin with a MissingPlugin as a delegate.
|
|
|
|
static CefPluginPlaceholder* CreateLoadableMissingPlugin(
|
|
|
|
content::RenderFrame* render_frame,
|
|
|
|
const blink::WebPluginParams& params);
|
|
|
|
|
|
|
|
void SetStatus(CefViewHostMsg_GetPluginInfo_Status status);
|
|
|
|
|
|
|
|
private:
|
|
|
|
CefPluginPlaceholder(content::RenderFrame* render_frame,
|
|
|
|
const blink::WebPluginParams& params,
|
|
|
|
const std::string& html_data,
|
|
|
|
const base::string16& title);
|
|
|
|
~CefPluginPlaceholder() override;
|
|
|
|
|
2016-05-25 01:35:43 +02:00
|
|
|
// content::LoadablePluginPlaceholder overrides:
|
2015-09-09 16:05:39 +02:00
|
|
|
blink::WebPlugin* CreatePlugin() override;
|
2016-07-21 23:21:32 +02:00
|
|
|
void OnBlockedTinyContent() override;
|
2015-09-09 16:05:39 +02:00
|
|
|
|
|
|
|
// gin::Wrappable (via PluginPlaceholder) method
|
|
|
|
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
|
|
|
v8::Isolate* isolate) final;
|
|
|
|
|
|
|
|
// content::RenderViewObserver (via PluginPlaceholder) override:
|
|
|
|
bool OnMessageReceived(const IPC::Message& message) override;
|
|
|
|
|
|
|
|
// WebViewPlugin::Delegate (via PluginPlaceholder) methods:
|
|
|
|
v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override;
|
|
|
|
void ShowContextMenu(const blink::WebMouseEvent&) override;
|
|
|
|
|
2016-05-25 01:35:43 +02:00
|
|
|
// content::RenderThreadObserver methods:
|
2015-09-09 16:05:39 +02:00
|
|
|
void PluginListChanged() override;
|
|
|
|
|
|
|
|
// content::ContextMenuClient methods:
|
|
|
|
void OnMenuAction(int request_id, unsigned action) override;
|
|
|
|
void OnMenuClosed(int request_id) override;
|
|
|
|
|
2016-10-21 21:52:29 +02:00
|
|
|
// Show the Plugins permission bubble.
|
|
|
|
void ShowPermissionBubbleCallback();
|
2015-09-09 16:05:39 +02:00
|
|
|
|
|
|
|
CefViewHostMsg_GetPluginInfo_Status status_;
|
|
|
|
|
|
|
|
base::string16 title_;
|
|
|
|
|
|
|
|
int context_menu_request_id_; // Nonzero when request pending.
|
|
|
|
base::string16 plugin_name_;
|
|
|
|
|
2016-07-21 23:21:32 +02:00
|
|
|
bool did_send_blocked_content_notification_;
|
2016-05-25 01:35:43 +02:00
|
|
|
|
2015-09-09 16:05:39 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefPluginPlaceholder);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|