| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool PrerenderManager::MaybeUsePrerenderedPage(const GURL& url, | 294 bool PrerenderManager::MaybeUsePrerenderedPage(const GURL& url, |
| 295 chrome::NavigateParams* params) { | 295 chrome::NavigateParams* params) { |
| 296 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 296 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 297 | 297 |
| 298 WebContents* web_contents = params->target_contents; | 298 WebContents* web_contents = params->target_contents; |
| 299 DCHECK(!IsWebContentsPrerendering(web_contents, nullptr)); | 299 DCHECK(!IsWebContentsPrerendering(web_contents, nullptr)); |
| 300 | 300 |
| 301 // Don't prerender if the navigation involves some special parameters. | 301 // Don't prerender if the navigation involves some special parameters that |
| 302 // are different from what was used by PrerenderContents::StartPrerendering |
| 303 // (which always uses GET method and doesn't specify any extra headers when |
| 304 // calling content::NavigationController::LoadURLWithParams). |
| 302 if (params->uses_post || !params->extra_headers.empty()) | 305 if (params->uses_post || !params->extra_headers.empty()) |
| 303 return false; | 306 return false; |
| 304 | 307 |
| 305 DeleteOldEntries(); | 308 DeleteOldEntries(); |
| 306 to_delete_prerenders_.clear(); | 309 to_delete_prerenders_.clear(); |
| 307 | 310 |
| 308 // First, try to find prerender data with the correct session storage | 311 // First, try to find prerender data with the correct session storage |
| 309 // namespace. | 312 // namespace. |
| 310 // TODO(ajwong): This doesn't handle isolated apps correctly. | 313 // TODO(ajwong): This doesn't handle isolated apps correctly. |
| 311 PrerenderData* prerender_data = FindPrerenderData( | 314 PrerenderData* prerender_data = FindPrerenderData( |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 DCHECK_EQ(1u, erased); | 1346 DCHECK_EQ(1u, erased); |
| 1344 } | 1347 } |
| 1345 | 1348 |
| 1346 void PrerenderManager::SetPrerenderContentsFactoryForTest( | 1349 void PrerenderManager::SetPrerenderContentsFactoryForTest( |
| 1347 PrerenderContents::Factory* prerender_contents_factory) { | 1350 PrerenderContents::Factory* prerender_contents_factory) { |
| 1348 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1351 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1349 prerender_contents_factory_.reset(prerender_contents_factory); | 1352 prerender_contents_factory_.reset(prerender_contents_factory); |
| 1350 } | 1353 } |
| 1351 | 1354 |
| 1352 } // namespace prerender | 1355 } // namespace prerender |
| OLD | NEW |