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

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 2186803004: predictors: Remove the HTTP restriction for speculative prefetch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/predictors/resource_prefetch_predictor.cc
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index bc941c5aac1b7634eed995e551f030cc298cefda..cbabd8d6c1eb69d8a0c373446944e4a88a17dfe9 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -43,8 +43,8 @@ namespace {
// For reporting whether a subresource is handled or not, and for what reasons.
enum ResourceStatus {
RESOURCE_STATUS_HANDLED = 0,
- RESOURCE_STATUS_NOT_HTTP_PAGE = 1,
- RESOURCE_STATUS_NOT_HTTP_RESOURCE = 2,
+ RESOURCE_STATUS_NOT_HTTP_OR_HTTPS_PAGE = 1,
+ RESOURCE_STATUS_NOT_HTTP_OR_HTTPS_RESOURCE = 2,
RESOURCE_STATUS_UNSUPPORTED_MIME_TYPE = 4,
RESOURCE_STATUS_NOT_GET = 8,
RESOURCE_STATUS_URL_TOO_LONG = 16,
@@ -232,18 +232,19 @@ bool ResourcePrefetchPredictor::ShouldRecordRedirect(
// static
bool ResourcePrefetchPredictor::IsHandledMainPage(net::URLRequest* request) {
- return request->original_url().scheme() == url::kHttpScheme;
+ return request->url().SchemeIsHTTPOrHTTPS();
}
// static
bool ResourcePrefetchPredictor::IsHandledSubresource(
net::URLRequest* response) {
int resource_status = 0;
- if (response->first_party_for_cookies().scheme() != url::kHttpScheme)
- resource_status |= RESOURCE_STATUS_NOT_HTTP_PAGE;
- if (response->original_url().scheme() != url::kHttpScheme)
- resource_status |= RESOURCE_STATUS_NOT_HTTP_RESOURCE;
+ if (!response->first_party_for_cookies().SchemeIsHTTPOrHTTPS())
+ resource_status |= RESOURCE_STATUS_NOT_HTTP_OR_HTTPS_PAGE;
+
+ if (!response->url().SchemeIsHTTPOrHTTPS())
+ resource_status |= RESOURCE_STATUS_NOT_HTTP_OR_HTTPS_RESOURCE;
std::string mime_type;
response->GetMimeType(&mime_type);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698