| 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 "content/browser/renderer_host/transfer_navigation_resource_throttle.h" | 5 #include "content/browser/renderer_host/transfer_navigation_resource_throttle.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/renderer_host/render_view_host_delegate.h" | 8 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 10 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // If a toplevel request is redirecting across extension extents, we want to | 56 // If a toplevel request is redirecting across extension extents, we want to |
| 57 // switch processes. We do this by deferring the redirect and resuming the | 57 // switch processes. We do this by deferring the redirect and resuming the |
| 58 // request once the navigation controller properly assigns the right process | 58 // request once the navigation controller properly assigns the right process |
| 59 // to host the new URL. | 59 // to host the new URL. |
| 60 // TODO(mpcomplete): handle for cases other than extensions (e.g. WebUI). | 60 // TODO(mpcomplete): handle for cases other than extensions (e.g. WebUI). |
| 61 ResourceContext* resource_context = info->GetContext(); | 61 ResourceContext* resource_context = info->GetContext(); |
| 62 if (GetContentClient()->browser()->ShouldSwapProcessesForRedirect( | 62 if (GetContentClient()->browser()->ShouldSwapProcessesForRedirect( |
| 63 resource_context, request_->url(), new_url)) { | 63 resource_context, request_->url(), new_url)) { |
| 64 int render_process_id, render_view_id; | 64 int render_process_id, render_view_id; |
| 65 if (info->GetAssociatedRenderView(&render_process_id, &render_view_id)) { | 65 if (info->GetAssociatedRenderView(&render_process_id, &render_view_id)) { |
| 66 ResourceDispatcherHostImpl::Get()->MarkAsTransferredNavigation(request_); | 66 GlobalRequestID global_id(info->GetChildID(), info->GetRequestID()); |
| 67 | 67 |
| 68 GlobalRequestID global_id(info->GetChildID(), info->GetRequestID()); | 68 ResourceDispatcherHostImpl::Get()->MarkAsTransferredNavigation(global_id); |
| 69 |
| 69 BrowserThread::PostTask( | 70 BrowserThread::PostTask( |
| 70 BrowserThread::UI, | 71 BrowserThread::UI, |
| 71 FROM_HERE, | 72 FROM_HERE, |
| 72 base::Bind(&RequestTransferURLOnUIThread, | 73 base::Bind(&RequestTransferURLOnUIThread, |
| 73 render_process_id, | 74 render_process_id, |
| 74 render_view_id, | 75 render_view_id, |
| 75 new_url, | 76 new_url, |
| 76 Referrer(GURL(request_->referrer()), info->GetReferrerPolicy()), | 77 Referrer(GURL(request_->referrer()), info->GetReferrerPolicy()), |
| 77 CURRENT_TAB, | 78 CURRENT_TAB, |
| 78 info->GetFrameID(), | 79 info->GetFrameID(), |
| 79 global_id)); | 80 global_id)); |
| 80 | 81 |
| 81 *defer = true; | 82 *defer = true; |
| 82 } | 83 } |
| 83 } | 84 } |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace content | 87 } // namespace content |
| OLD | NEW |