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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 2397783003: Allows prerendering to continue for offline requests even if the url was recently visited. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 IPC_END_MESSAGE_MAP() 495 IPC_END_MESSAGE_MAP()
496 496
497 return handled; 497 return handled;
498 } 498 }
499 499
500 bool PrerenderContents::CheckURL(const GURL& url) { 500 bool PrerenderContents::CheckURL(const GURL& url) {
501 if (!url.SchemeIsHTTPOrHTTPS()) { 501 if (!url.SchemeIsHTTPOrHTTPS()) {
502 Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); 502 Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME);
503 return false; 503 return false;
504 } 504 }
505 if (prerender_manager_->HasRecentlyBeenNavigatedTo(origin(), url)) { 505 if (origin() != ORIGIN_OFFLINE &&
506 prerender_manager_->HasRecentlyBeenNavigatedTo(origin(), url)) {
506 Destroy(FINAL_STATUS_RECENTLY_VISITED); 507 Destroy(FINAL_STATUS_RECENTLY_VISITED);
507 return false; 508 return false;
508 } 509 }
509 return true; 510 return true;
510 } 511 }
511 512
512 bool PrerenderContents::AddAliasURL(const GURL& url) { 513 bool PrerenderContents::AddAliasURL(const GURL& url) {
513 if (!CheckURL(url)) 514 if (!CheckURL(url))
514 return false; 515 return false;
515 516
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 void PrerenderContents::AddResourceThrottle( 757 void PrerenderContents::AddResourceThrottle(
757 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { 758 const base::WeakPtr<PrerenderResourceThrottle>& throttle) {
758 resource_throttles_.push_back(throttle); 759 resource_throttles_.push_back(throttle);
759 } 760 }
760 761
761 void PrerenderContents::AddNetworkBytes(int64_t bytes) { 762 void PrerenderContents::AddNetworkBytes(int64_t bytes) {
762 network_bytes_ += bytes; 763 network_bytes_ += bytes;
763 } 764 }
764 765
765 } // namespace prerender 766 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698