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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 1497623002: Plugin Power Saver: Improve Poster behavior for essential plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 is_flash || override_for_testing == "ignore-list"; 817 is_flash || override_for_testing == "ignore-list";
818 818
819 bool power_saver_setting_on = 819 bool power_saver_setting_on =
820 status == 820 status ==
821 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; 821 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
822 822
823 bool power_saver_enabled = 823 bool power_saver_enabled =
824 override_for_testing == "always" || 824 override_for_testing == "always" ||
825 (power_saver_setting_on && can_throttle_plugin_type); 825 (power_saver_setting_on && can_throttle_plugin_type);
826 bool blocked_for_background_tab = 826 bool blocked_for_background_tab =
827 power_saver_enabled && render_frame->IsHidden(); 827 power_saver_enabled && render_frame->IsHidden();
groby-ooo-7-16 2015/12/04 22:06:56 Don't we need to fix up power_saver_enabled before
tommycli 2015/12/07 22:06:18 Hmm... actually I think the ordering here is corre
groby-ooo-7-16 2015/12/07 22:16:04 Wait - we defer even same-origin on the background
tommycli 2015/12/07 22:22:13 Yep. Same behavior on VIDEO tag now too. The plugi
828 828
829 PlaceholderPosterInfo poster_info; 829 PlaceholderPosterInfo poster_info;
830 if (power_saver_enabled) { 830 if (power_saver_enabled) {
831 poster_info.poster_attribute = 831 bool essential_origin = !render_frame->ShouldThrottleContent(
832 GetPluginInstancePosterAttribute(params); 832 render_frame->GetWebFrame()->top()->securityOrigin(),
833 poster_info.base_url = frame->document().url(); 833 url::Origin(params.url), -1, -1, nullptr);
groby-ooo-7-16 2015/12/04 22:06:56 Ugh. Three mystery params.
tommycli 2015/12/07 22:06:18 Done.
834
835 if (essential_origin) {
836 // Turn off power saver and ignore poster for same-origin and
837 // whitelisted-origin plugin content.
838 power_saver_enabled = false;
839 } else {
840 poster_info.poster_attribute =
841 GetPluginInstancePosterAttribute(params);
842 poster_info.base_url = frame->document().url();
843 }
groby-ooo-7-16 2015/12/04 22:06:56 In general, that's a whole chunk of code just deal
tommycli 2015/12/07 22:06:18 Done.
834 } 844 }
835 845
836 if (is_flash) 846 if (is_flash)
837 TrackPosterParamPresence(params, power_saver_enabled); 847 TrackPosterParamPresence(params, power_saver_enabled);
838 848
839 if (blocked_for_background_tab || is_prerendering || 849 if (blocked_for_background_tab || is_prerendering ||
840 !poster_info.poster_attribute.empty()) { 850 !poster_info.poster_attribute.empty()) {
841 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin( 851 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin(
842 render_frame, frame, params, info, identifier, group_name, 852 render_frame, frame, params, info, identifier, group_name,
843 poster_info.poster_attribute.empty() ? IDR_BLOCKED_PLUGIN_HTML 853 poster_info.poster_attribute.empty() ? IDR_BLOCKED_PLUGIN_HTML
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 // chrome.system.network.getNetworkInterfaces provides the same 1491 // chrome.system.network.getNetworkInterfaces provides the same
1482 // information. Also, the enforcement of sending and binding UDP is already done 1492 // information. Also, the enforcement of sending and binding UDP is already done
1483 // by chrome extension permission model. 1493 // by chrome extension permission model.
1484 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { 1494 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() {
1485 #if defined(ENABLE_EXTENSIONS) 1495 #if defined(ENABLE_EXTENSIONS)
1486 return !IsStandaloneExtensionProcess(); 1496 return !IsStandaloneExtensionProcess();
1487 #else 1497 #else
1488 return true; 1498 return true;
1489 #endif 1499 #endif
1490 } 1500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698