| 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_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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 588 } |
| 589 | 589 |
| 590 if (prerender_contents->starting_page_id() <= | 590 if (prerender_contents->starting_page_id() <= |
| 591 tab_contents->GetMaxPageID()) { | 591 tab_contents->GetMaxPageID()) { |
| 592 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); | 592 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); |
| 593 return false; | 593 return false; |
| 594 } | 594 } |
| 595 | 595 |
| 596 // Don't use prerendered pages if debugger is attached to the tab. | 596 // Don't use prerendered pages if debugger is attached to the tab. |
| 597 // See http://crbug.com/98541 | 597 // See http://crbug.com/98541 |
| 598 if (RenderViewDevToolsAgentHost::IsDebuggerAttached(tab_contents)) { | 598 if (content::DevToolsAgentHostRegistry::IsDebuggerAttached(tab_contents)) { |
| 599 prerender_contents.release()->Destroy(FINAL_STATUS_DEVTOOLS_ATTACHED); | 599 prerender_contents.release()->Destroy(FINAL_STATUS_DEVTOOLS_ATTACHED); |
| 600 return false; | 600 return false; |
| 601 } | 601 } |
| 602 | 602 |
| 603 // If the prerendered page is in the middle of a cross-site navigation, | 603 // If the prerendered page is in the middle of a cross-site navigation, |
| 604 // don't swap it in because there isn't a good way to merge histories. | 604 // don't swap it in because there isn't a good way to merge histories. |
| 605 if (prerender_contents->IsCrossSiteNavigationPending()) { | 605 if (prerender_contents->IsCrossSiteNavigationPending()) { |
| 606 prerender_contents.release()->Destroy( | 606 prerender_contents.release()->Destroy( |
| 607 FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING); | 607 FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING); |
| 608 return false; | 608 return false; |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1154 if (!render_process_host || !render_process_host->GetBrowserContext()) |
| 1155 return NULL; | 1155 return NULL; |
| 1156 Profile* profile = Profile::FromBrowserContext( | 1156 Profile* profile = Profile::FromBrowserContext( |
| 1157 render_process_host->GetBrowserContext()); | 1157 render_process_host->GetBrowserContext()); |
| 1158 if (!profile) | 1158 if (!profile) |
| 1159 return NULL; | 1159 return NULL; |
| 1160 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1160 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 } // namespace prerender | 1163 } // namespace prerender |
| OLD | NEW |