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/renderer_host/transfer_navigation_resource_handler.h" | 5 #include "chrome/browser/renderer_host/transfer_navigation_resource_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/profiles/profile_io_data.h" | 8 #include "chrome/browser/profiles/profile_io_data.h" |
9 #include "chrome/browser/extensions/extension_info_map.h" | 9 #include "chrome/browser/extensions/extension_info_map.h" |
10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
11 #include "content/browser/renderer_host/render_view_host_delegate.h" | 11 #include "content/browser/renderer_host/render_view_host_delegate.h" |
12 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 12 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
13 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 13 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
14 #include "content/public/common/referrer.h" | |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 // This code is borrowed from ChromeContentRendererClient. We want to mimic | 18 // This code is borrowed from ChromeContentRendererClient. We want to mimic |
18 // the logic used by the renderer. | 19 // the logic used by the renderer. |
19 // TODO(mpcomplete): move to common and share with the renderer logic. | 20 // TODO(mpcomplete): move to common and share with the renderer logic. |
20 // http://crbug.com/79520 | 21 // http://crbug.com/79520 |
21 const Extension* GetNonBookmarkAppExtension( | 22 const Extension* GetNonBookmarkAppExtension( |
22 const ExtensionSet& extensions, const GURL& url) { | 23 const ExtensionSet& extensions, const GURL& url) { |
23 // Exclude bookmark apps, which do not use the app process model. | 24 // Exclude bookmark apps, which do not use the app process model. |
(...skipping 21 matching lines...) Expand all Loading... | |
45 !old_url_extension->web_extent().is_empty(); | 46 !old_url_extension->web_extent().is_empty(); |
46 if (old_url_is_hosted_app) | 47 if (old_url_is_hosted_app) |
47 return false; | 48 return false; |
48 | 49 |
49 return old_url_extension != new_url_extension; | 50 return old_url_extension != new_url_extension; |
50 } | 51 } |
51 | 52 |
52 void RequestTransferURLOnUIThread(int render_process_id, | 53 void RequestTransferURLOnUIThread(int render_process_id, |
53 int render_view_id, | 54 int render_view_id, |
54 GURL new_url, | 55 GURL new_url, |
55 GURL referrer, | 56 content::Referrer referrer, |
Matt Perry
2011/12/05 19:48:10
while you're here, can you fix these to pass by co
| |
56 WindowOpenDisposition window_open_disposition, | 57 WindowOpenDisposition window_open_disposition, |
57 int64 frame_id, | 58 int64 frame_id, |
58 const GlobalRequestID& request_id) { | 59 const GlobalRequestID& request_id) { |
59 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, | 60 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, |
60 render_view_id); | 61 render_view_id); |
61 if (!rvh) | 62 if (!rvh) |
62 return; | 63 return; |
63 | 64 |
64 RenderViewHostDelegate* delegate = rvh->delegate(); | 65 RenderViewHostDelegate* delegate = rvh->delegate(); |
65 if (!delegate) | 66 if (!delegate) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 request_, &render_process_id, &render_view_id)) { | 116 request_, &render_process_id, &render_view_id)) { |
116 | 117 |
117 GlobalRequestID global_id(info->child_id(), info->request_id()); | 118 GlobalRequestID global_id(info->child_id(), info->request_id()); |
118 rdh_->MarkAsTransferredNavigation(global_id, request_); | 119 rdh_->MarkAsTransferredNavigation(global_id, request_); |
119 | 120 |
120 content::BrowserThread::PostTask( | 121 content::BrowserThread::PostTask( |
121 content::BrowserThread::UI, | 122 content::BrowserThread::UI, |
122 FROM_HERE, | 123 FROM_HERE, |
123 base::Bind(&RequestTransferURLOnUIThread, | 124 base::Bind(&RequestTransferURLOnUIThread, |
124 render_process_id, render_view_id, | 125 render_process_id, render_view_id, |
125 new_url, GURL(request_->referrer()), CURRENT_TAB, | 126 new_url, |
126 info->frame_id(), global_id)); | 127 content::Referrer(GURL(request_->referrer()), |
128 info->referrer_policy()), | |
129 CURRENT_TAB, info->frame_id(), global_id)); | |
127 | 130 |
128 *defer = true; | 131 *defer = true; |
129 return true; | 132 return true; |
130 } | 133 } |
131 } | 134 } |
132 | 135 |
133 return next_handler_->OnRequestRedirected( | 136 return next_handler_->OnRequestRedirected( |
134 request_id, new_url, response, defer); | 137 request_id, new_url, response, defer); |
135 } | 138 } |
136 | 139 |
(...skipping 23 matching lines...) Expand all Loading... | |
160 bool TransferNavigationResourceHandler::OnResponseCompleted( | 163 bool TransferNavigationResourceHandler::OnResponseCompleted( |
161 int request_id, | 164 int request_id, |
162 const net::URLRequestStatus& status, | 165 const net::URLRequestStatus& status, |
163 const std::string& security_info) { | 166 const std::string& security_info) { |
164 return next_handler_->OnResponseCompleted(request_id, status, security_info); | 167 return next_handler_->OnResponseCompleted(request_id, status, security_info); |
165 } | 168 } |
166 | 169 |
167 void TransferNavigationResourceHandler::OnRequestClosed() { | 170 void TransferNavigationResourceHandler::OnRequestClosed() { |
168 next_handler_->OnRequestClosed(); | 171 next_handler_->OnRequestClosed(); |
169 } | 172 } |
OLD | NEW |