OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 const bool https = url.SchemeIs(chrome::kHttpsScheme); | 490 const bool https = url.SchemeIs(chrome::kHttpsScheme); |
491 if (!(http || https)) { | 491 if (!(http || https)) { |
492 Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); | 492 Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); |
493 return false; | 493 return false; |
494 } | 494 } |
495 if (https && !prerender_manager_->config().https_allowed) { | 495 if (https && !prerender_manager_->config().https_allowed) { |
496 Destroy(FINAL_STATUS_HTTPS); | 496 Destroy(FINAL_STATUS_HTTPS); |
497 return false; | 497 return false; |
498 } | 498 } |
499 if (prerender_manager_->HasRecentlyBeenNavigatedTo(url)) { | 499 if (prerender_manager_->HasRecentlyBeenNavigatedTo(url)) { |
500 Destroy(FINAL_STATUS_RECENTLY_VISITED); | 500 Destroy(FINAL_STATUS_RECENTLY_VISITED); |
dominich
2011/11/16 19:11:26
What happens if we call Destroy here when adding t
tburkard
2011/11/16 19:21:31
not running these checks anymore, adding directly,
| |
501 return false; | 501 return false; |
502 } | 502 } |
503 | 503 |
504 alias_urls_.push_back(url); | 504 alias_urls_.push_back(url); |
505 prerender_tracker_->AddPrerenderURLOnUIThread(url); | 505 prerender_tracker_->AddPrerenderURLOnUIThread(url); |
506 return true; | 506 return true; |
507 } | 507 } |
508 | 508 |
509 void PrerenderContents::AddAliasURLsFromOtherPrerenderContents( | |
510 PrerenderContents* other_pc) { | |
511 for (std::vector<GURL>::const_iterator it = other_pc->alias_urls_.begin(); | |
512 it != other_pc->alias_urls_.end(); | |
513 ++it) { | |
514 AddAliasURL*it); | |
dominich
2011/11/16 19:11:26
CHECK the return value here - it would be awful if
tburkard
2011/11/16 19:21:31
not running these checks anymore, adding directly,
| |
515 } | |
516 } | |
517 | |
509 bool PrerenderContents::MatchesURL(const GURL& url, GURL* matching_url) const { | 518 bool PrerenderContents::MatchesURL(const GURL& url, GURL* matching_url) const { |
510 std::vector<GURL>::const_iterator matching_url_iterator = | 519 std::vector<GURL>::const_iterator matching_url_iterator = |
511 std::find_if(alias_urls_.begin(), | 520 std::find_if(alias_urls_.begin(), |
512 alias_urls_.end(), | 521 alias_urls_.end(), |
513 PrerenderURLPredicate(url)); | 522 PrerenderURLPredicate(url)); |
514 if (matching_url_iterator != alias_urls_.end()) { | 523 if (matching_url_iterator != alias_urls_.end()) { |
515 if (matching_url) | 524 if (matching_url) |
516 *matching_url = *matching_url_iterator; | 525 *matching_url = *matching_url_iterator; |
517 return true; | 526 return true; |
518 } | 527 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
667 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 676 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
668 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) | 677 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) |
669 return false; | 678 return false; |
670 const TabContents* tab_contents = prerender_contents_->tab_contents(); | 679 const TabContents* tab_contents = prerender_contents_->tab_contents(); |
671 return (tab_contents->GetSiteInstance() != | 680 return (tab_contents->GetSiteInstance() != |
672 tab_contents->GetPendingSiteInstance()); | 681 tab_contents->GetPendingSiteInstance()); |
673 } | 682 } |
674 | 683 |
675 | 684 |
676 } // namespace prerender | 685 } // namespace prerender |
OLD | NEW |