| OLD | NEW |
| 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_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 DCHECK(CalledOnValidThread()); | 692 DCHECK(CalledOnValidThread()); |
| 693 return prerendered_tab_contents_set_.count(web_contents) > 0; | 693 return prerendered_tab_contents_set_.count(web_contents) > 0; |
| 694 } | 694 } |
| 695 | 695 |
| 696 bool PrerenderManager::WouldWebContentsBePrerendered( | 696 bool PrerenderManager::WouldWebContentsBePrerendered( |
| 697 WebContents* web_contents) const { | 697 WebContents* web_contents) const { |
| 698 DCHECK(CalledOnValidThread()); | 698 DCHECK(CalledOnValidThread()); |
| 699 return would_be_prerendered_tab_contents_set_.count(web_contents) > 0; | 699 return would_be_prerendered_tab_contents_set_.count(web_contents) > 0; |
| 700 } | 700 } |
| 701 | 701 |
| 702 bool PrerenderManager::IsOldRenderViewHost( | |
| 703 const RenderViewHost* render_view_host) const { | |
| 704 for (std::list<TabContentsWrapper*>::const_iterator it = | |
| 705 old_tab_contents_list_.begin(); | |
| 706 it != old_tab_contents_list_.end(); | |
| 707 ++it) { | |
| 708 if ((*it)->web_contents()->GetRenderViewHost() == render_view_host) | |
| 709 return true; | |
| 710 } | |
| 711 return false; | |
| 712 } | |
| 713 | |
| 714 bool PrerenderManager::HasRecentlyBeenNavigatedTo(const GURL& url) { | 702 bool PrerenderManager::HasRecentlyBeenNavigatedTo(const GURL& url) { |
| 715 DCHECK(CalledOnValidThread()); | 703 DCHECK(CalledOnValidThread()); |
| 716 | 704 |
| 717 CleanUpOldNavigations(); | 705 CleanUpOldNavigations(); |
| 718 std::list<NavigationRecord>::const_reverse_iterator end = navigations_.rend(); | 706 std::list<NavigationRecord>::const_reverse_iterator end = navigations_.rend(); |
| 719 for (std::list<NavigationRecord>::const_reverse_iterator it = | 707 for (std::list<NavigationRecord>::const_reverse_iterator it = |
| 720 navigations_.rbegin(); | 708 navigations_.rbegin(); |
| 721 it != end; | 709 it != end; |
| 722 ++it) { | 710 ++it) { |
| 723 if (it->url_ == url) { | 711 if (it->url_ == url) { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1238 if (!render_process_host || !render_process_host->GetBrowserContext()) |
| 1251 return NULL; | 1239 return NULL; |
| 1252 Profile* profile = Profile::FromBrowserContext( | 1240 Profile* profile = Profile::FromBrowserContext( |
| 1253 render_process_host->GetBrowserContext()); | 1241 render_process_host->GetBrowserContext()); |
| 1254 if (!profile) | 1242 if (!profile) |
| 1255 return NULL; | 1243 return NULL; |
| 1256 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1244 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
| 1257 } | 1245 } |
| 1258 | 1246 |
| 1259 } // namespace prerender | 1247 } // namespace prerender |
| OLD | NEW |