Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4836)

Unified Diff: chrome/renderer/plugins/chrome_plugin_placeholder.cc

Issue 2143073002: Plugin Power Saver: Improve blocked tiny plugins behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename a variable again Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/plugins/chrome_plugin_placeholder.h ('k') | chrome/renderer/plugins/power_saver_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
index 5939797963a7087c270eaf7b46fd25a5010f1df1..575aeda7650705131a85049e139a019fa22be305 100644
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
@@ -65,7 +65,7 @@ ChromePluginPlaceholder::ChromePluginPlaceholder(
status_(ChromeViewHostMsg_GetPluginInfo_Status::kAllowed),
title_(title),
context_menu_request_id_(0),
- ignore_updates_(false) {
+ did_send_blocked_content_notification_(false) {
RenderThread::Get()->AddObserver(this);
}
@@ -170,39 +170,6 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin(
return blocked_plugin;
}
-// static
-ChromePluginPlaceholder* ChromePluginPlaceholder::CreateDelayedPlugin(
- content::RenderFrame* render_frame,
- blink::WebLocalFrame* frame,
- const blink::WebPluginParams& params,
- const content::WebPluginInfo& info,
- const std::string& identifier,
- const base::string16& name,
- const PowerSaverInfo& power_saver_info) {
- // Can never be called with an actual poster.
- DCHECK(power_saver_info.poster_attribute.empty());
-
- // Can never be called when blocked for background tab.
- DCHECK(!power_saver_info.blocked_for_background_tab);
-
- const base::StringPiece template_html(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_PLUGIN_DELAY_HTML));
- base::DictionaryValue values;
- std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
-
- // |delay_plugin| will destroy itself when its WebViewPlugin is going away.
- ChromePluginPlaceholder* delay_plugin =
- new ChromePluginPlaceholder(render_frame, frame, params, html_data, name);
-
- delay_plugin->set_delayed(true);
- delay_plugin->SetPluginInfo(info);
- delay_plugin->SetIdentifier(identifier);
- delay_plugin->set_power_saver_enabled(power_saver_info.power_saver_enabled);
-
- return delay_plugin;
-}
-
void ChromePluginPlaceholder::SetStatus(
ChromeViewHostMsg_GetPluginInfo_Status status) {
status_ = status;
@@ -408,33 +375,13 @@ blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() {
GetPluginParams(), std::move(throttler));
}
-void ChromePluginPlaceholder::OnLoadedRectUpdate(
- const gfx::Rect& unobscured_rect,
- content::RenderFrame::PeripheralContentStatus status) {
- // If the placeholder is in the blocked state, do nothing.
- if (ignore_updates_)
- return;
-
- // This should only be called once.
- set_delayed(false);
-
- // block tiny cross-origin - simply by not continuing the load chain.
- if (status ==
- content::RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY) {
- ContentSettingsObserver* observer =
- ContentSettingsObserver::Get(render_frame());
- observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, title_);
- AllowLoading();
- ignore_updates_ = true;
+void ChromePluginPlaceholder::OnBlockedTinyContent() {
+ if (did_send_blocked_content_notification_)
return;
- }
-
- // For essential content, powersaver can be turned off.
- if (status != content::RenderFrame::CONTENT_STATUS_PERIPHERAL)
- set_power_saver_enabled(false);
- AllowLoading();
- LoadPlugin();
+ did_send_blocked_content_notification_ = true;
+ ContentSettingsObserver::Get(render_frame())
+ ->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, title_);
}
gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder(
« no previous file with comments | « chrome/renderer/plugins/chrome_plugin_placeholder.h ('k') | chrome/renderer/plugins/power_saver_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698