| 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 alias_urls_.push_back(*it); |
| 515 prerender_tracker_->AddPrerenderURLOnUIThread(*it); |
| 516 } |
| 517 } |
| 518 |
| 509 bool PrerenderContents::MatchesURL(const GURL& url, GURL* matching_url) const { | 519 bool PrerenderContents::MatchesURL(const GURL& url, GURL* matching_url) const { |
| 510 std::vector<GURL>::const_iterator matching_url_iterator = | 520 std::vector<GURL>::const_iterator matching_url_iterator = |
| 511 std::find_if(alias_urls_.begin(), | 521 std::find_if(alias_urls_.begin(), |
| 512 alias_urls_.end(), | 522 alias_urls_.end(), |
| 513 PrerenderURLPredicate(url)); | 523 PrerenderURLPredicate(url)); |
| 514 if (matching_url_iterator != alias_urls_.end()) { | 524 if (matching_url_iterator != alias_urls_.end()) { |
| 515 if (matching_url) | 525 if (matching_url) |
| 516 *matching_url = *matching_url_iterator; | 526 *matching_url = *matching_url_iterator; |
| 517 return true; | 527 return true; |
| 518 } | 528 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 677 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 668 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) | 678 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) |
| 669 return false; | 679 return false; |
| 670 const TabContents* tab_contents = prerender_contents_->tab_contents(); | 680 const TabContents* tab_contents = prerender_contents_->tab_contents(); |
| 671 return (tab_contents->GetSiteInstance() != | 681 return (tab_contents->GetSiteInstance() != |
| 672 tab_contents->GetPendingSiteInstance()); | 682 tab_contents->GetPendingSiteInstance()); |
| 673 } | 683 } |
| 674 | 684 |
| 675 | 685 |
| 676 } // namespace prerender | 686 } // namespace prerender |
| OLD | NEW |