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

Unified Diff: content/renderer/peripheral_content_heuristic.cc

Issue 1528653002: Revert of 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/peripheral_content_heuristic.cc
diff --git a/content/renderer/peripheral_content_heuristic.cc b/content/renderer/peripheral_content_heuristic.cc
index 3b36af811c11e192958e4124d67c6c45df9c4f86..b2c59c994a8af6e54f2c883155648d61d3c8dd20 100644
--- a/content/renderer/peripheral_content_heuristic.cc
+++ b/content/renderer/peripheral_content_heuristic.cc
@@ -5,8 +5,6 @@
#include "content/renderer/peripheral_content_heuristic.h"
#include <cmath>
-
-#include "ui/gfx/geometry/size.h"
namespace content {
@@ -32,37 +30,33 @@
} // namespace
// static
-RenderFrame::PeripheralContentStatus
+PeripheralContentHeuristic::Decision
PeripheralContentHeuristic::GetPeripheralStatus(
const std::set<url::Origin>& origin_whitelist,
const url::Origin& main_frame_origin,
const url::Origin& content_origin,
- const gfx::Size& unobscured_size) {
+ int width,
+ int height) {
if (main_frame_origin.IsSameOriginWith(content_origin))
- return RenderFrame::CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN;
+ return HEURISTIC_DECISION_ESSENTIAL_SAME_ORIGIN;
+
+ if (width <= 0 || height <= 0)
+ return HEURISTIC_DECISION_ESSENTIAL_UNKNOWN_SIZE;
if (origin_whitelist.count(content_origin))
- return RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED;
+ return HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_WHITELISTED;
- if (unobscured_size.IsEmpty())
- return RenderFrame::CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE;
+ if (width <= kTinyContentSize && height <= kTinyContentSize)
+ return HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_TINY;
- if (unobscured_size.width() <= kTinyContentSize &&
- unobscured_size.height() <= kTinyContentSize) {
- return RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY;
- }
+ if (IsLargeContent(width, height))
+ return HEURISTIC_DECISION_ESSENTIAL_CROSS_ORIGIN_BIG;
- if (IsLargeContent(unobscured_size))
- return RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG;
-
- return RenderFrame::CONTENT_STATUS_PERIPHERAL;
+ return HEURISTIC_DECISION_PERIPHERAL;
}
// static
-bool PeripheralContentHeuristic::IsLargeContent(
- const gfx::Size& unobscured_size) {
- int width = unobscured_size.width();
- int height = unobscured_size.height();
+bool PeripheralContentHeuristic::IsLargeContent(int width, int height) {
if (width >= kLargeContentMinWidth && height >= kLargeContentMinHeight)
return true;
« no previous file with comments | « content/renderer/peripheral_content_heuristic.h ('k') | content/renderer/peripheral_content_heuristic_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698