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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
7 #include "content/common/frame_messages.h" | 7 #include "content/common/frame_messages.h" |
8 #include "content/public/renderer/document_state.h" | 8 #include "content/public/renderer/document_state.h" |
9 #include "content/public/renderer/navigation_state.h" | 9 #include "content/public/renderer/navigation_state.h" |
10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // These numeric values are used in UMA logs; do not change them. | 21 // These numeric values are used in UMA logs; do not change them. |
22 enum PeripheralHeuristicDecision { | 22 enum PeripheralHeuristicDecision { |
23 HEURISTIC_DECISION_PERIPHERAL = 0, | 23 HEURISTIC_DECISION_PERIPHERAL = 0, |
24 HEURISTIC_DECISION_ESSENTIAL_SAME_ORIGIN = 1, | 24 HEURISTIC_DECISION_ESSENTIAL_SAME_ORIGIN = 1, |
25 HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_BIG = 2, | 25 HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_BIG = 2, |
26 HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_WHITELISTED = 3, | 26 HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_WHITELISTED = 3, |
27 HEURISTIC_DECISION_NUM_ITEMS | 27 HEURISTIC_DECISION_NUM_ITEMS |
28 }; | 28 }; |
29 | 29 |
30 const char kPeripheralHeuristicHistogram[] = | 30 const char kPeripheralHeuristicHistogram[] = |
31 "Plugin.PowerSaverPeripheralHeuristic"; | 31 "Plugin.PowerSaver.PeripheralHeuristic"; |
32 | 32 |
33 // Maximum dimensions plug-in content may have while still being considered | 33 // Maximum dimensions plug-in content may have while still being considered |
34 // peripheral content. These match the sizes used by Safari. | 34 // peripheral content. These match the sizes used by Safari. |
35 const int kPeripheralContentMaxWidth = 400; | 35 const int kPeripheralContentMaxWidth = 400; |
36 const int kPeripheralContentMaxHeight = 300; | 36 const int kPeripheralContentMaxHeight = 300; |
37 | 37 |
38 void RecordDecisionMetric(PeripheralHeuristicDecision decision) { | 38 void RecordDecisionMetric(PeripheralHeuristicDecision decision) { |
39 UMA_HISTOGRAM_ENUMERATION(kPeripheralHeuristicHistogram, decision, | 39 UMA_HISTOGRAM_ENUMERATION(kPeripheralHeuristicHistogram, decision, |
40 HEURISTIC_DECISION_NUM_ITEMS); | 40 HEURISTIC_DECISION_NUM_ITEMS); |
41 } | 41 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 void PluginPowerSaverHelper::WhitelistContentOrigin( | 149 void PluginPowerSaverHelper::WhitelistContentOrigin( |
150 const GURL& content_origin) { | 150 const GURL& content_origin) { |
151 if (origin_whitelist_.insert(content_origin).second) { | 151 if (origin_whitelist_.insert(content_origin).second) { |
152 Send(new FrameHostMsg_PluginContentOriginAllowed( | 152 Send(new FrameHostMsg_PluginContentOriginAllowed( |
153 render_frame()->GetRoutingID(), content_origin)); | 153 render_frame()->GetRoutingID(), content_origin)); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 } // namespace content | 157 } // namespace content |
OLD | NEW |