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

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

Issue 2563493002: Disallow showing offline previews on a reload. (Closed)
Patch Set: tbansal comments Created 4 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: 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..82d17b20ca0b223b5a631688c1940195a14f9d7a 100644
--- a/components/previews/core/previews_io_data.cc
+++ b/components/previews/core/previews_io_data.cc
@@ -15,6 +15,7 @@
#include "components/previews/core/previews_black_list.h"
#include "components/previews/core/previews_opt_out_store.h"
#include "components/previews/core/previews_ui_service.h"
+#include "net/base/load_flags.h"
#include "net/nqe/network_quality_estimator.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
@@ -117,6 +118,15 @@ bool PreviewsIOData::ShouldAllowPreview(const net::URLRequest& request,
type);
return false;
}
+ // LOAD_VALIDATE_CACHE or LOAD_BYPASS_CACHE mean the user reloaded the page.
+ // If this is a query for offline previews, reloads should be disallowed.
+ if (type == PreviewsType::OFFLINE &&
+ request.load_flags() &
+ (net::LOAD_VALIDATE_CACHE | net::LOAD_BYPASS_CACHE)) {
+ LogPreviewsEligibilityReason(
+ PreviewsEligibilityReason::RELOAD_DISALLOWED_FOR_OFFLINE, type);
+ return false;
+ }
LogPreviewsEligibilityReason(PreviewsEligibilityReason::ALLOWED, type);
return true;
}
« no previous file with comments | « components/previews/core/previews_black_list.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