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 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/prerender/prerender_tab_helper.h" | 32 #include "chrome/browser/prerender/prerender_tab_helper.h" |
33 #include "chrome/browser/prerender/prerender_util.h" | 33 #include "chrome/browser/prerender/prerender_util.h" |
34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/search/search.h" | 35 #include "chrome/browser/search/search.h" |
36 #include "chrome/browser/tab_contents/tab_util.h" | 36 #include "chrome/browser/tab_contents/tab_util.h" |
37 #include "chrome/browser/ui/browser_navigator.h" | 37 #include "chrome/browser/ui/browser_navigator.h" |
38 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 38 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
39 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 39 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
40 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
41 #include "chrome/common/prerender_types.h" | 41 #include "chrome/common/prerender_types.h" |
| 42 #include "components/search/search.h" |
42 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/devtools_agent_host.h" | 44 #include "content/public/browser/devtools_agent_host.h" |
44 #include "content/public/browser/navigation_controller.h" | 45 #include "content/public/browser/navigation_controller.h" |
45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/notification_source.h" | 47 #include "content/public/browser/notification_source.h" |
47 #include "content/public/browser/render_frame_host.h" | 48 #include "content/public/browser/render_frame_host.h" |
48 #include "content/public/browser/render_process_host.h" | 49 #include "content/public/browser/render_process_host.h" |
49 #include "content/public/browser/render_view_host.h" | 50 #include "content/public/browser/render_view_host.h" |
50 #include "content/public/browser/resource_request_details.h" | 51 #include "content/public/browser/resource_request_details.h" |
51 #include "content/public/browser/session_storage_namespace.h" | 52 #include "content/public/browser/session_storage_namespace.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 SessionStorageNamespace* session_storage_namespace, | 295 SessionStorageNamespace* session_storage_namespace, |
295 const gfx::Size& size) { | 296 const gfx::Size& size) { |
296 return AddPrerender(ORIGIN_EXTERNAL_REQUEST, url, referrer, size, | 297 return AddPrerender(ORIGIN_EXTERNAL_REQUEST, url, referrer, size, |
297 session_storage_namespace); | 298 session_storage_namespace); |
298 } | 299 } |
299 | 300 |
300 PrerenderHandle* PrerenderManager::AddPrerenderForInstant( | 301 PrerenderHandle* PrerenderManager::AddPrerenderForInstant( |
301 const GURL& url, | 302 const GURL& url, |
302 content::SessionStorageNamespace* session_storage_namespace, | 303 content::SessionStorageNamespace* session_storage_namespace, |
303 const gfx::Size& size) { | 304 const gfx::Size& size) { |
304 DCHECK(chrome::ShouldPrefetchSearchResults()); | 305 DCHECK(search::ShouldPrefetchSearchResults()); |
305 return AddPrerender(ORIGIN_INSTANT, url, content::Referrer(), size, | 306 return AddPrerender(ORIGIN_INSTANT, url, content::Referrer(), size, |
306 session_storage_namespace); | 307 session_storage_namespace); |
307 } | 308 } |
308 | 309 |
309 void PrerenderManager::CancelAllPrerenders() { | 310 void PrerenderManager::CancelAllPrerenders() { |
310 DCHECK(CalledOnValidThread()); | 311 DCHECK(CalledOnValidThread()); |
311 while (!active_prerenders_.empty()) { | 312 while (!active_prerenders_.empty()) { |
312 PrerenderContents* prerender_contents = | 313 PrerenderContents* prerender_contents = |
313 active_prerenders_.front()->contents(); | 314 active_prerenders_.front()->contents(); |
314 prerender_contents->Destroy(FINAL_STATUS_CANCELLED); | 315 prerender_contents->Destroy(FINAL_STATUS_CANCELLED); |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 } | 1286 } |
1286 | 1287 |
1287 void PrerenderManager::RenderProcessHostDestroyed( | 1288 void PrerenderManager::RenderProcessHostDestroyed( |
1288 content::RenderProcessHost* host) { | 1289 content::RenderProcessHost* host) { |
1289 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1290 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1290 size_t erased = prerender_process_hosts_.erase(host); | 1291 size_t erased = prerender_process_hosts_.erase(host); |
1291 DCHECK_EQ(1u, erased); | 1292 DCHECK_EQ(1u, erased); |
1292 } | 1293 } |
1293 | 1294 |
1294 } // namespace prerender | 1295 } // namespace prerender |
OLD | NEW |