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

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

Issue 2748033002: Revert of Moving previews code from components/ to chrome/ (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/previews/core/previews_io_data.h ('k') | components/previews/core/previews_io_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9645fa249513ccc186559024eee32088444a2ec5..0a7af37fda2653d9ddf580fe6411677afb1a1d84 100644
--- a/components/previews/core/previews_io_data.cc
+++ b/components/previews/core/previews_io_data.cc
@@ -51,10 +51,8 @@
void PreviewsIOData::Initialize(
base::WeakPtr<PreviewsUIService> previews_ui_service,
- std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store,
- const PreviewsIsEnabledCallback& is_enabled_callback) {
+ std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
- is_enabled_callback_ = is_enabled_callback;
previews_ui_service_ = previews_ui_service;
// Set up the IO thread portion of |this|.
@@ -90,16 +88,15 @@
bool PreviewsIOData::ShouldAllowPreview(const net::URLRequest& request,
PreviewsType type) const {
- if (is_enabled_callback_.is_null() || !previews_black_list_) {
+ if (!IsPreviewsTypeEnabled(type))
+ 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;
}
- if (!is_enabled_callback_.Run(type))
- return false;
-
- // The blacklist will disallow certain hosts for periods of time based on
- // user's opting out of the preview
PreviewsEligibilityReason status =
previews_black_list_->IsLoadedAndAllowed(request.url(), type);
if (status != PreviewsEligibilityReason::ALLOWED) {
« no previous file with comments | « components/previews/core/previews_io_data.h ('k') | components/previews/core/previews_io_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698