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

Side by Side Diff: chrome/renderer/plugins/power_saver_info.cc

Issue 2356053002: [HBD] Only use Plugin Content Settings for Flash. (Closed)
Patch Set: address xhwang comments Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « chrome/common/plugin_utils.cc ('k') | chrome/test/data/load_clearkey_no_js.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/renderer/plugins/power_saver_info.h" 10 #include "chrome/renderer/plugins/power_saver_info.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 83 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
84 std::string override_for_testing = command_line->GetSwitchValueASCII( 84 std::string override_for_testing = command_line->GetSwitchValueASCII(
85 switches::kOverridePluginPowerSaverForTesting); 85 switches::kOverridePluginPowerSaverForTesting);
86 86
87 // This feature has only been tested thoroughly with Flash thus far. 87 // This feature has only been tested thoroughly with Flash thus far.
88 // It is also enabled for the Power Saver test plugin for browser tests. 88 // It is also enabled for the Power Saver test plugin for browser tests.
89 bool is_flash = 89 bool is_flash =
90 plugin_info.name == base::ASCIIToUTF16(content::kFlashPluginName); 90 plugin_info.name == base::ASCIIToUTF16(content::kFlashPluginName);
91 91
92 PowerSaverInfo info; 92 PowerSaverInfo info;
93 bool is_eligible = power_saver_setting_on && 93 bool is_eligible = power_saver_setting_on && is_flash;
94 (is_flash || override_for_testing == "ignore-list");
95 info.power_saver_enabled = override_for_testing == "always" || 94 info.power_saver_enabled = override_for_testing == "always" ||
96 (power_saver_setting_on && is_eligible); 95 (power_saver_setting_on && is_eligible);
97 96
98 if (info.power_saver_enabled) { 97 if (info.power_saver_enabled) {
99 // Even if we disable PPS in the next block because content is same-origin, 98 // Even if we disable PPS in the next block because content is same-origin,
100 // it should still be eligible for background tab deferral if PPS is on. 99 // it should still be eligible for background tab deferral if PPS is on.
101 info.blocked_for_background_tab = render_frame->IsHidden(); 100 info.blocked_for_background_tab = render_frame->IsHidden();
102 101
103 auto status = render_frame->GetPeripheralContentStatus( 102 auto status = render_frame->GetPeripheralContentStatus(
104 render_frame->GetWebFrame()->top()->getSecurityOrigin(), 103 render_frame->GetWebFrame()->top()->getSecurityOrigin(),
(...skipping 14 matching lines...) Expand all
119 info.poster_attribute = GetPluginInstancePosterAttribute(params); 118 info.poster_attribute = GetPluginInstancePosterAttribute(params);
120 info.base_url = document_url; 119 info.base_url = document_url;
121 } 120 }
122 } 121 }
123 122
124 if (is_flash) 123 if (is_flash)
125 TrackPosterParamPresence(params, info.power_saver_enabled); 124 TrackPosterParamPresence(params, info.power_saver_enabled);
126 125
127 return info; 126 return info;
128 } 127 }
OLDNEW
« no previous file with comments | « chrome/common/plugin_utils.cc ('k') | chrome/test/data/load_clearkey_no_js.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698