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

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

Issue 2563493002: Disallow showing offline previews on a reload. (Closed)
Patch Set: testing 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..3dcc1982b60afb103ad03a727d7ec19646b872f1 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 and LOAD_BYPASS_CACHE mean the user reloaded the page.
tbansal1 2016/12/12 19:52:21 s/and/or/ Also, I am not sure if the statement is
RyanSturm 2016/12/12 22:42:15 Done.
+ // 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;
}

Powered by Google App Engine
This is Rietveld 408576698