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

Unified Diff: components/previews/core/previews_io_data.cc

Issue 2491803002: Revert "Adding UMA to track previews opt outs and blacklist eligibility" (Closed)
Patch Set: Created 4 years, 1 month 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: components/previews/core/previews_io_data.cc
diff --git a/components/previews/core/previews_io_data.cc b/components/previews/core/previews_io_data.cc
index ed9f784d7cbd27e7da14f95ecaa8508f7c0e5cb0..496ef6dd69141a7c0af73634837ad38984b1c451 100644
--- a/components/previews/core/previews_io_data.cc
+++ b/components/previews/core/previews_io_data.cc
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
-#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "base/time/default_clock.h"
#include "components/previews/core/previews_black_list.h"
@@ -22,23 +21,6 @@
namespace previews {
-namespace {
-
-void LogPreviewsEligibilityReason(PreviewsEligibilityReason status,
- PreviewsType type) {
- switch (type) {
- case PreviewsType::OFFLINE:
- UMA_HISTOGRAM_ENUMERATION(
- "Previews.EligibilityReason.Offline", static_cast<int>(status),
- static_cast<int>(PreviewsEligibilityReason::LAST));
- break;
- default:
- NOTREACHED();
- }
-}
-
-} // namespace
-
PreviewsIOData::PreviewsIOData(
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
@@ -91,34 +73,19 @@ bool PreviewsIOData::ShouldAllowPreview(const net::URLRequest& request,
return false;
// The blacklist will disallow certain hosts for periods of time based on
// user's opting out of the preview
- if (!previews_black_list_) {
- LogPreviewsEligibilityReason(
- PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE, type);
- return false;
- }
- PreviewsEligibilityReason status =
- previews_black_list_->IsLoadedAndAllowed(request.url(), type);
- if (status != PreviewsEligibilityReason::ALLOWED) {
- LogPreviewsEligibilityReason(status, type);
+ if (!previews_black_list_ ||
+ !previews_black_list_->IsLoadedAndAllowed(request.url(), type)) {
return false;
}
net::NetworkQualityEstimator* network_quality_estimator =
request.context()->network_quality_estimator();
- if (!network_quality_estimator ||
- network_quality_estimator->GetEffectiveConnectionType() <
- net::EFFECTIVE_CONNECTION_TYPE_OFFLINE) {
- LogPreviewsEligibilityReason(
- PreviewsEligibilityReason::NETWORK_QUALITY_UNAVAILABLE, type);
- return false;
- }
- if (network_quality_estimator->GetEffectiveConnectionType() >
- net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G) {
- LogPreviewsEligibilityReason(PreviewsEligibilityReason::NETWORK_NOT_SLOW,
- type);
+ if (!network_quality_estimator)
return false;
- }
- LogPreviewsEligibilityReason(PreviewsEligibilityReason::ALLOWED, type);
- return true;
+
+ net::EffectiveConnectionType effective_connection_type =
+ network_quality_estimator->GetEffectiveConnectionType();
+ return effective_connection_type >= net::EFFECTIVE_CONNECTION_TYPE_OFFLINE &&
+ effective_connection_type <= net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
}
} // namespace previews
« no previous file with comments | « components/previews/core/previews_black_list_unittest.cc ('k') | components/previews/core/previews_io_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698