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/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/download/download_request_limiter.h" | 10 #include "chrome/browser/download/download_request_limiter.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 resource_type, | 170 resource_type, |
171 throttles); | 171 throttles); |
172 } | 172 } |
173 | 173 |
174 void ChromeResourceDispatcherHostDelegate::DownloadStarting( | 174 void ChromeResourceDispatcherHostDelegate::DownloadStarting( |
175 net::URLRequest* request, | 175 net::URLRequest* request, |
176 content::ResourceContext* resource_context, | 176 content::ResourceContext* resource_context, |
177 int child_id, | 177 int child_id, |
178 int route_id, | 178 int route_id, |
179 int request_id, | 179 int request_id, |
180 bool is_new_request, | 180 bool from_web, |
181 ScopedVector<content::ResourceThrottle>* throttles) { | 181 ScopedVector<content::ResourceThrottle>* throttles) { |
182 BrowserThread::PostTask( | 182 BrowserThread::PostTask( |
183 BrowserThread::UI, FROM_HERE, | 183 BrowserThread::UI, FROM_HERE, |
184 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); | 184 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); |
185 | 185 |
186 // If it's from the web, we don't trust it, so we push the throttle on. | |
187 if (from_web) { | |
darin (slow to review)
2012/05/12 18:23:08
elsewhere, we use "content-initiated" versus "brow
Randy Smith (Not in Mondays)
2012/05/12 19:56:37
Done.
| |
188 throttles->push_back(new DownloadResourceThrottle( | |
189 download_request_limiter_, child_id, route_id, request_id, | |
190 request->method())); | |
191 } | |
192 | |
186 // If this isn't a new request, we've seen this before and added the safe | 193 // If this isn't a new request, we've seen this before and added the safe |
darin (slow to review)
2012/05/12 18:23:08
nit: this comment should be changed to say "and ad
Randy Smith (Not in Mondays)
2012/05/12 19:56:37
Done.
| |
187 // browsing resource throttle already so no need to add it again. This code | 194 // browsing resource throttle already so no need to add it again. |
188 // path is only hit for requests initiated through the browser, and not the | 195 if (!request->is_pending()) { |
darin (slow to review)
2012/05/12 18:23:08
Definitely OK to make this change. I had this on
Randy Smith (Not in Mondays)
2012/05/12 19:56:37
Done.
| |
189 // web, so no need to add the download throttle. | |
190 if (is_new_request) { | |
191 AppendStandardResourceThrottles(request, | 196 AppendStandardResourceThrottles(request, |
192 resource_context, | 197 resource_context, |
193 child_id, | 198 child_id, |
194 route_id, | 199 route_id, |
195 ResourceType::MAIN_FRAME, | 200 ResourceType::MAIN_FRAME, |
196 throttles); | 201 throttles); |
197 } else { | |
198 throttles->push_back(new DownloadResourceThrottle( | |
199 download_request_limiter_, child_id, route_id, request_id, | |
200 request->method())); | |
201 } | 202 } |
202 } | 203 } |
203 | 204 |
204 bool ChromeResourceDispatcherHostDelegate::AcceptSSLClientCertificateRequest( | 205 bool ChromeResourceDispatcherHostDelegate::AcceptSSLClientCertificateRequest( |
205 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { | 206 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { |
206 if (request->load_flags() & net::LOAD_PREFETCH) | 207 if (request->load_flags() & net::LOAD_PREFETCH) |
207 return false; | 208 return false; |
208 | 209 |
209 ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request); | 210 ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request); |
210 if (user_data && user_data->is_prerender()) { | 211 if (user_data && user_data->is_prerender()) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 338 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
338 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 339 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
339 | 340 |
340 // See if the response contains the Google-Accounts-SignIn header. If so, | 341 // See if the response contains the Google-Accounts-SignIn header. If so, |
341 // then the user has just finished signing in, and the server is allowing the | 342 // then the user has just finished signing in, and the server is allowing the |
342 // browser to suggest connecting the user's profile to the account. | 343 // browser to suggest connecting the user's profile to the account. |
343 OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(), | 344 OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(), |
344 info->GetRouteID()); | 345 info->GetRouteID()); |
345 #endif | 346 #endif |
346 } | 347 } |
OLD | NEW |