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

Unified Diff: chrome/browser/prerender/prerender_resource_handler.cc

Issue 6543010: Revert 75393 - Cancel prerender if any of the visited URLs are https.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
Index: chrome/browser/prerender/prerender_resource_handler.cc
===================================================================
--- chrome/browser/prerender/prerender_resource_handler.cc (revision 75394)
+++ chrome/browser/prerender/prerender_resource_handler.cc (working copy)
@@ -14,32 +14,16 @@
namespace {
-bool ShouldPrerenderURL(const GURL& url) {
- if (!url.is_valid())
- return false;
- if (!url.SchemeIs("http")) {
- RecordFinalStatus(FINAL_STATUS_HTTPS);
- return false;
- }
- return true;
-}
-
-bool ValidateAliasURLs(const std::vector<GURL>& urls) {
- for (std::vector<GURL>::const_iterator it = urls.begin();
- it != urls.end();
- ++it) {
- if (!ShouldPrerenderURL(*it))
- return false;
- }
- return true;
-}
-
-bool ShouldPrerender(const ResourceResponse* response) {
+bool ShouldPrerender(const GURL& url, const ResourceResponse* response) {
if (!response)
return false;
const ResourceResponseHead& rrh = response->response_head;
+ if (!url.is_valid())
+ return false;
if (!rrh.headers)
return false;
+ if (!(url.SchemeIs("http") || url.SchemeIs("https")))
+ return false;
if (rrh.mime_type != "text/html")
return false;
if (rrh.headers->response_code() != 200)
@@ -57,8 +41,6 @@
return NULL;
if (!(request.load_flags() & net::LOAD_PREFETCH))
return NULL;
- if (!ShouldPrerenderURL(request.url()))
- return NULL;
if (request.method() != "GET")
return NULL;
return new PrerenderResourceHandler(request,
@@ -107,8 +89,6 @@
bool will_redirect = next_handler_->OnRequestRedirected(
request_id, url, response, defer);
if (will_redirect) {
- if (!ShouldPrerenderURL(url))
- return false;
alias_urls_.push_back(url);
url_ = url;
}
@@ -117,8 +97,7 @@
bool PrerenderResourceHandler::OnResponseStarted(int request_id,
ResourceResponse* response) {
- if (ShouldPrerender(response)) {
- DCHECK(ValidateAliasURLs(alias_urls_));
+ if (ShouldPrerender(url_, response)) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
@@ -137,8 +116,6 @@
bool* defer) {
bool will_start = next_handler_->OnWillStart(request_id, url, defer);
if (will_start) {
- if (!ShouldPrerenderURL(url))
- return false;
alias_urls_.push_back(url);
url_ = url;
}
« no previous file with comments | « chrome/browser/prerender/prerender_resource_handler.h ('k') | chrome/browser/prerender/prerender_resource_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698