| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 origin, used, prerender_bytes, recent_profile_bytes); | 1859 origin, used, prerender_bytes, recent_profile_bytes); |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 bool PrerenderManager::IsEnabled() const { | 1862 bool PrerenderManager::IsEnabled() const { |
| 1863 DCHECK(CalledOnValidThread()); | 1863 DCHECK(CalledOnValidThread()); |
| 1864 | 1864 |
| 1865 // TODO(bnc): remove conditional as per crbug.com/334602. | 1865 // TODO(bnc): remove conditional as per crbug.com/334602. |
| 1866 if (profile_ && profile_->GetPrefs() && | 1866 if (profile_ && profile_->GetPrefs() && |
| 1867 profile_->GetPrefs()->GetInteger(prefs::kNetworkPredictionOptions) != | 1867 profile_->GetPrefs()->GetInteger(prefs::kNetworkPredictionOptions) != |
| 1868 chrome_browser_net::NETWORK_PREDICTION_UNSET) { | 1868 chrome_browser_net::NETWORK_PREDICTION_UNSET) { |
| 1869 return chrome_browser_net::CanPredictNetworkActionsUI(profile_->GetPrefs()); | 1869 return chrome_browser_net::CanPrefetchAndPrerenderUI(profile_->GetPrefs()); |
| 1870 } | 1870 } |
| 1871 // TODO(bnc): remove rest of method as per crbug.com/334602. | 1871 // TODO(bnc): remove rest of method as per crbug.com/334602. |
| 1872 if (!enabled_) | 1872 if (!enabled_) |
| 1873 return false; | 1873 return false; |
| 1874 for (std::list<const PrerenderCondition*>::const_iterator it = | 1874 for (std::list<const PrerenderCondition*>::const_iterator it = |
| 1875 prerender_conditions_.begin(); | 1875 prerender_conditions_.begin(); |
| 1876 it != prerender_conditions_.end(); | 1876 it != prerender_conditions_.end(); |
| 1877 ++it) { | 1877 ++it) { |
| 1878 const PrerenderCondition* condition = *it; | 1878 const PrerenderCondition* condition = *it; |
| 1879 if (!condition->CanPrerender()) | 1879 if (!condition->CanPrerender()) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 content::RenderProcessHost* host) { | 1918 content::RenderProcessHost* host) { |
| 1919 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1919 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1920 prerender_process_hosts_.erase(host); | 1920 prerender_process_hosts_.erase(host); |
| 1921 BrowserThread::PostTask( | 1921 BrowserThread::PostTask( |
| 1922 BrowserThread::IO, FROM_HERE, | 1922 BrowserThread::IO, FROM_HERE, |
| 1923 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, | 1923 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, |
| 1924 base::Unretained(prerender_tracker()), host->GetID(), false)); | 1924 base::Unretained(prerender_tracker()), host->GetID(), false)); |
| 1925 } | 1925 } |
| 1926 | 1926 |
| 1927 } // namespace prerender | 1927 } // namespace prerender |
| OLD | NEW |