| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "chrome/common/prerender_messages.h" | 48 #include "chrome/common/prerender_messages.h" |
| 49 #include "chrome/common/prerender_types.h" | 49 #include "chrome/common/prerender_types.h" |
| 50 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 51 #include "content/public/browser/devtools_agent_host.h" | 51 #include "content/public/browser/devtools_agent_host.h" |
| 52 #include "content/public/browser/navigation_controller.h" | 52 #include "content/public/browser/navigation_controller.h" |
| 53 #include "content/public/browser/notification_service.h" | 53 #include "content/public/browser/notification_service.h" |
| 54 #include "content/public/browser/notification_source.h" | 54 #include "content/public/browser/notification_source.h" |
| 55 #include "content/public/browser/render_frame_host.h" | 55 #include "content/public/browser/render_frame_host.h" |
| 56 #include "content/public/browser/render_process_host.h" | 56 #include "content/public/browser/render_process_host.h" |
| 57 #include "content/public/browser/render_view_host.h" | 57 #include "content/public/browser/render_view_host.h" |
| 58 #include "content/public/browser/resource_request_details.h" |
| 58 #include "content/public/browser/session_storage_namespace.h" | 59 #include "content/public/browser/session_storage_namespace.h" |
| 59 #include "content/public/browser/site_instance.h" | 60 #include "content/public/browser/site_instance.h" |
| 60 #include "content/public/browser/storage_partition.h" | 61 #include "content/public/browser/storage_partition.h" |
| 61 #include "content/public/browser/web_contents.h" | 62 #include "content/public/browser/web_contents.h" |
| 62 #include "content/public/browser/web_contents_delegate.h" | 63 #include "content/public/browser/web_contents_delegate.h" |
| 63 #include "content/public/common/url_constants.h" | 64 #include "content/public/common/url_constants.h" |
| 64 #include "extensions/common/constants.h" | 65 #include "extensions/common/constants.h" |
| 65 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 66 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 66 #include "net/url_request/url_request_context.h" | 67 #include "net/url_request/url_request_context.h" |
| 67 #include "net/url_request/url_request_context_getter.h" | 68 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 } | 1090 } |
| 1090 | 1091 |
| 1091 seen_target_route_id_ = true; | 1092 seen_target_route_id_ = true; |
| 1092 target_route_id_ = PrerenderTracker::ChildRouteIdPair( | 1093 target_route_id_ = PrerenderTracker::ChildRouteIdPair( |
| 1093 render_view_host->GetMainFrame()->GetProcess()->GetID(), | 1094 render_view_host->GetMainFrame()->GetProcess()->GetID(), |
| 1094 render_view_host->GetMainFrame()->GetRoutingID()); | 1095 render_view_host->GetMainFrame()->GetRoutingID()); |
| 1095 manager_->prerender_tracker()->AddPrerenderPendingSwap( | 1096 manager_->prerender_tracker()->AddPrerenderPendingSwap( |
| 1096 target_route_id_, url_); | 1097 target_route_id_, url_); |
| 1097 } | 1098 } |
| 1098 | 1099 |
| 1099 void PrerenderManager::PendingSwap::ProvisionalChangeToMainFrameUrl( | 1100 void PrerenderManager::PendingSwap::DidStartProvisionalLoadForFrame( |
| 1100 const GURL& url, | 1101 content::RenderFrameHost* render_frame_host, |
| 1101 content::RenderFrameHost* render_frame_host) { | 1102 const GURL& validated_url, |
| 1102 // We must only cancel the pending swap if the |url| navigated to is not | 1103 bool is_error_page, |
| 1104 bool is_iframe_srcdoc) { |
| 1105 if (render_frame_host->GetParent()) |
| 1106 return; |
| 1107 |
| 1108 // We must only cancel the pending swap if the url navigated to is not |
| 1103 // the URL being attempted to be swapped in. That's because in the normal | 1109 // the URL being attempted to be swapped in. That's because in the normal |
| 1104 // flow, a ProvisionalChangeToMainFrameUrl will happen for the URL attempted | 1110 // flow, a ProvisionalChangeToMainFrameUrl will happen for the URL attempted |
| 1105 // to be swapped in immediately after the pending swap has issued its merge. | 1111 // to be swapped in immediately after the pending swap has issued its merge. |
| 1106 if (url != url_) | 1112 if (validated_url != url_) |
| 1107 prerender_data_->ClearPendingSwap(); | 1113 prerender_data_->ClearPendingSwap(); |
| 1108 } | 1114 } |
| 1109 | 1115 |
| 1110 void PrerenderManager::PendingSwap::DidCommitProvisionalLoadForFrame( | 1116 void PrerenderManager::PendingSwap::DidCommitProvisionalLoadForFrame( |
| 1111 content::RenderFrameHost* render_frame_host, | 1117 content::RenderFrameHost* render_frame_host, |
| 1112 const GURL& validated_url, | 1118 const GURL& validated_url, |
| 1113 ui::PageTransition transition_type) { | 1119 ui::PageTransition transition_type) { |
| 1114 if (render_frame_host->GetParent()) | 1120 if (render_frame_host->GetParent()) |
| 1115 return; | 1121 return; |
| 1116 prerender_data_->ClearPendingSwap(); | 1122 prerender_data_->ClearPendingSwap(); |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 content::RenderProcessHost* host) { | 1894 content::RenderProcessHost* host) { |
| 1889 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1895 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1890 prerender_process_hosts_.erase(host); | 1896 prerender_process_hosts_.erase(host); |
| 1891 BrowserThread::PostTask( | 1897 BrowserThread::PostTask( |
| 1892 BrowserThread::IO, FROM_HERE, | 1898 BrowserThread::IO, FROM_HERE, |
| 1893 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, | 1899 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, |
| 1894 base::Unretained(prerender_tracker()), host->GetID(), false)); | 1900 base::Unretained(prerender_tracker()), host->GetID(), false)); |
| 1895 } | 1901 } |
| 1896 | 1902 |
| 1897 } // namespace prerender | 1903 } // namespace prerender |
| OLD | NEW |