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_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 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/prerender/prerender_tab_helper.h" | 28 #include "chrome/browser/prerender/prerender_tab_helper.h" |
29 #include "chrome/browser/prerender/prerender_tracker.h" | 29 #include "chrome/browser/prerender/prerender_tracker.h" |
30 #include "chrome/browser/prerender/prerender_util.h" | 30 #include "chrome/browser/prerender/prerender_util.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
34 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/render_messages.h" | 36 #include "chrome/common/render_messages.h" |
37 #include "content/browser/cancelable_request.h" | 37 #include "content/browser/cancelable_request.h" |
38 #include "content/browser/debugger/render_view_devtools_agent_host.h" | |
39 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 38 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
40 #include "content/browser/renderer_host/render_view_host.h" | 39 #include "content/browser/renderer_host/render_view_host.h" |
41 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 40 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
42 #include "content/browser/tab_contents/render_view_host_manager.h" | 41 #include "content/browser/tab_contents/render_view_host_manager.h" |
43 #include "content/browser/tab_contents/tab_contents.h" | 42 #include "content/browser/tab_contents/tab_contents.h" |
44 #include "content/browser/tab_contents/tab_contents_delegate.h" | 43 #include "content/browser/tab_contents/tab_contents_delegate.h" |
45 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
| 45 #include "content/public/browser/devtools/devtools_agent_host_registry.h" |
46 #include "content/public/browser/notification_observer.h" | 46 #include "content/public/browser/notification_observer.h" |
47 #include "content/public/browser/notification_registrar.h" | 47 #include "content/public/browser/notification_registrar.h" |
48 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
49 #include "content/public/browser/render_process_host.h" | 49 #include "content/public/browser/render_process_host.h" |
50 | 50 |
51 using content::BrowserThread; | 51 using content::BrowserThread; |
52 | 52 |
53 namespace prerender { | 53 namespace prerender { |
54 | 54 |
55 namespace { | 55 namespace { |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 581 } |
582 | 582 |
583 if (prerender_contents->starting_page_id() <= | 583 if (prerender_contents->starting_page_id() <= |
584 tab_contents->GetMaxPageID()) { | 584 tab_contents->GetMaxPageID()) { |
585 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); | 585 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); |
586 return false; | 586 return false; |
587 } | 587 } |
588 | 588 |
589 // Don't use prerendered pages if debugger is attached to the tab. | 589 // Don't use prerendered pages if debugger is attached to the tab. |
590 // See http://crbug.com/98541 | 590 // See http://crbug.com/98541 |
591 if (RenderViewDevToolsAgentHost::IsDebuggerAttached(tab_contents)) { | 591 if (content::DevToolsAgentHostRegistry::IsDebuggerAttached(tab_contents)) { |
592 prerender_contents.release()->Destroy(FINAL_STATUS_DEVTOOLS_ATTACHED); | 592 prerender_contents.release()->Destroy(FINAL_STATUS_DEVTOOLS_ATTACHED); |
593 return false; | 593 return false; |
594 } | 594 } |
595 | 595 |
596 // If the prerendered page is in the middle of a cross-site navigation, | 596 // If the prerendered page is in the middle of a cross-site navigation, |
597 // don't swap it in because there isn't a good way to merge histories. | 597 // don't swap it in because there isn't a good way to merge histories. |
598 if (prerender_contents->IsCrossSiteNavigationPending()) { | 598 if (prerender_contents->IsCrossSiteNavigationPending()) { |
599 prerender_contents.release()->Destroy( | 599 prerender_contents.release()->Destroy( |
600 FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING); | 600 FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING); |
601 return false; | 601 return false; |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1143 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1144 return NULL; | 1144 return NULL; |
1145 Profile* profile = Profile::FromBrowserContext( | 1145 Profile* profile = Profile::FromBrowserContext( |
1146 render_process_host->GetBrowserContext()); | 1146 render_process_host->GetBrowserContext()); |
1147 if (!profile) | 1147 if (!profile) |
1148 return NULL; | 1148 return NULL; |
1149 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1149 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1150 } | 1150 } |
1151 | 1151 |
1152 } // namespace prerender | 1152 } // namespace prerender |
OLD | NEW |