mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision d7d5682a (#367535)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/renderer/plugins/cef_plugin_placeholder.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
#include "libcef/renderer/plugins/plugin_preroller.h"
|
||||
@@ -95,7 +97,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
const base::string16& name,
|
||||
int template_id,
|
||||
const base::string16& message,
|
||||
const PlaceholderPosterInfo& poster_info) {
|
||||
const PowerSaverInfo& power_saver_info) {
|
||||
base::DictionaryValue values;
|
||||
values.SetString("message", message);
|
||||
values.SetString("name", name);
|
||||
@@ -106,16 +108,17 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
? "document"
|
||||
: "embedded");
|
||||
|
||||
if (!poster_info.poster_attribute.empty()) {
|
||||
values.SetString("poster", poster_info.poster_attribute);
|
||||
values.SetString("baseurl", poster_info.base_url.spec());
|
||||
if (!power_saver_info.poster_attribute.empty()) {
|
||||
values.SetString("poster", power_saver_info.poster_attribute);
|
||||
values.SetString("baseurl", power_saver_info.base_url.spec());
|
||||
|
||||
if (!poster_info.custom_poster_size.IsEmpty()) {
|
||||
if (!power_saver_info.custom_poster_size.IsEmpty()) {
|
||||
float zoom_factor =
|
||||
blink::WebView::zoomLevelToZoomFactor(frame->view()->zoomLevel());
|
||||
int width = roundf(poster_info.custom_poster_size.width() / zoom_factor);
|
||||
int width =
|
||||
roundf(power_saver_info.custom_poster_size.width() / zoom_factor);
|
||||
int height =
|
||||
roundf(poster_info.custom_poster_size.height() / zoom_factor);
|
||||
roundf(power_saver_info.custom_poster_size.height() / zoom_factor);
|
||||
values.SetString("visibleWidth", base::IntToString(width) + "px");
|
||||
values.SetString("visibleHeight", base::IntToString(height) + "px");
|
||||
}
|
||||
@@ -132,10 +135,15 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
CefPluginPlaceholder* blocked_plugin = new CefPluginPlaceholder(
|
||||
render_frame, frame, params, html_data, name);
|
||||
|
||||
if (!poster_info.poster_attribute.empty())
|
||||
if (!power_saver_info.poster_attribute.empty())
|
||||
blocked_plugin->BlockForPowerSaverPoster();
|
||||
blocked_plugin->SetPluginInfo(info);
|
||||
blocked_plugin->SetIdentifier(identifier);
|
||||
|
||||
blocked_plugin->set_power_saver_enabled(power_saver_info.power_saver_enabled);
|
||||
blocked_plugin->set_blocked_for_background_tab(
|
||||
power_saver_info.blocked_for_background_tab);
|
||||
|
||||
return blocked_plugin;
|
||||
}
|
||||
|
||||
@@ -271,7 +279,7 @@ blink::WebPlugin* CefPluginPlaceholder::CreatePlugin() {
|
||||
throttler.get());
|
||||
}
|
||||
return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(),
|
||||
GetPluginParams(), throttler.Pass());
|
||||
GetPluginParams(), std::move(throttler));
|
||||
}
|
||||
|
||||
gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder(
|
||||
|
@@ -5,29 +5,16 @@
|
||||
#ifndef CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
||||
#define CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "components/plugins/renderer/loadable_plugin_placeholder.h"
|
||||
#include "content/public/renderer/context_menu_client.h"
|
||||
#include "content/public/renderer/render_process_observer.h"
|
||||
|
||||
namespace gfx {
|
||||
class Size;
|
||||
}
|
||||
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
|
||||
// This contains information specifying the poster image of plugin placeholders.
|
||||
// The default constructor specifies no poster image.
|
||||
struct PlaceholderPosterInfo {
|
||||
// The poster image specified in image 'srcset' attribute format.
|
||||
std::string poster_attribute;
|
||||
|
||||
// Used to resolve relative paths in |poster_attribute|.
|
||||
GURL base_url;
|
||||
|
||||
// Specify this to provide partially obscured plugins a centered poster image.
|
||||
gfx::Size custom_poster_size;
|
||||
};
|
||||
|
||||
class CefPluginPlaceholder final
|
||||
: public plugins::LoadablePluginPlaceholder,
|
||||
public content::RenderProcessObserver,
|
||||
@@ -45,7 +32,7 @@ class CefPluginPlaceholder final
|
||||
const base::string16& name,
|
||||
int resource_id,
|
||||
const base::string16& message,
|
||||
const PlaceholderPosterInfo& poster_info);
|
||||
const PowerSaverInfo& power_saver_info);
|
||||
|
||||
// Creates a new WebViewPlugin with a MissingPlugin as a delegate.
|
||||
static CefPluginPlaceholder* CreateLoadableMissingPlugin(
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "third_party/WebKit/public/platform/WebRect.h"
|
||||
#include "third_party/WebKit/public/web/WebElement.h"
|
||||
#include "third_party/WebKit/public/web/WebPlugin.h"
|
||||
@@ -60,14 +61,15 @@ void CefPluginPreroller::OnThrottleStateChange() {
|
||||
if (!throttler_->IsThrottled())
|
||||
return;
|
||||
|
||||
PlaceholderPosterInfo poster_info;
|
||||
poster_info.poster_attribute = keyframe_data_url_.spec();
|
||||
poster_info.custom_poster_size = throttler_->GetSize();
|
||||
PowerSaverInfo power_saver_info;
|
||||
power_saver_info.power_saver_enabled = true;
|
||||
power_saver_info.poster_attribute = keyframe_data_url_.spec();
|
||||
power_saver_info.custom_poster_size = throttler_->GetSize();
|
||||
|
||||
CefPluginPlaceholder* placeholder =
|
||||
CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame(), frame_, params_, info_, identifier_, name_,
|
||||
IDR_PLUGIN_POSTER_HTML, message_, poster_info);
|
||||
IDR_PLUGIN_POSTER_HTML, message_, power_saver_info);
|
||||
placeholder->SetPremadePlugin(throttler_);
|
||||
placeholder->set_power_saver_enabled(true);
|
||||
placeholder->AllowLoading();
|
||||
|
Reference in New Issue
Block a user