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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (prerender_manager_->HasRecentlyBeenNavigatedTo(url)) { | 499 if (prerender_manager_->HasRecentlyBeenNavigatedTo(url)) { |
500 Destroy(FINAL_STATUS_RECENTLY_VISITED); | 500 Destroy(FINAL_STATUS_RECENTLY_VISITED); |
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); |
| 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 |