OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/pepper/plugin_power_saver_helper.h" | 5 #include "content/renderer/pepper/plugin_power_saver_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const gfx::Size& unobscured_size, | 105 const gfx::Size& unobscured_size, |
106 RenderFrame::RecordPeripheralDecision record_decision) const { | 106 RenderFrame::RecordPeripheralDecision record_decision) const { |
107 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 107 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
108 switches::kOverridePluginPowerSaverForTesting) == "always") { | 108 switches::kOverridePluginPowerSaverForTesting) == "always") { |
109 return RenderFrame::CONTENT_STATUS_PERIPHERAL; | 109 return RenderFrame::CONTENT_STATUS_PERIPHERAL; |
110 } | 110 } |
111 | 111 |
112 auto status = PeripheralContentHeuristic::GetPeripheralStatus( | 112 auto status = PeripheralContentHeuristic::GetPeripheralStatus( |
113 origin_whitelist_, main_frame_origin, content_origin, unobscured_size); | 113 origin_whitelist_, main_frame_origin, content_origin, unobscured_size); |
114 | 114 |
115 // Never record ESSENTIAL_UNKNOWN_SIZE. Wait for retest after size is known. | 115 // Never record UNKNOWN_SIZE. Wait for retest after size is known. |
116 if (record_decision == RenderFrame::RECORD_DECISION && | 116 if (record_decision == RenderFrame::RECORD_DECISION && |
117 status != RenderFrame::CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE) { | 117 status != RenderFrame::CONTENT_STATUS_UNKNOWN_SIZE) { |
118 UMA_HISTOGRAM_ENUMERATION(kPeripheralHeuristicHistogram, status, | 118 UMA_HISTOGRAM_ENUMERATION(kPeripheralHeuristicHistogram, status, |
119 RenderFrame::CONTENT_STATUS_NUM_ITEMS); | 119 RenderFrame::CONTENT_STATUS_NUM_ITEMS); |
120 } | 120 } |
121 | 121 |
122 return status; | 122 return status; |
123 } | 123 } |
124 | 124 |
125 void PluginPowerSaverHelper::WhitelistContentOrigin( | 125 void PluginPowerSaverHelper::WhitelistContentOrigin( |
126 const url::Origin& content_origin) { | 126 const url::Origin& content_origin) { |
127 if (origin_whitelist_.insert(content_origin).second) { | 127 if (origin_whitelist_.insert(content_origin).second) { |
128 Send(new FrameHostMsg_PluginContentOriginAllowed( | 128 Send(new FrameHostMsg_PluginContentOriginAllowed( |
129 render_frame()->GetRoutingID(), content_origin)); | 129 render_frame()->GetRoutingID(), content_origin)); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 } // namespace content | 133 } // namespace content |
OLD | NEW |