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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "content/public/browser/content_browser_client.h" | 53 #include "content/public/browser/content_browser_client.h" |
54 #include "content/public/browser/download_manager.h" | 54 #include "content/public/browser/download_manager.h" |
55 #include "content/public/browser/global_request_id.h" | 55 #include "content/public/browser/global_request_id.h" |
56 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
57 #include "content/public/browser/render_view_host_delegate.h" | 57 #include "content/public/browser/render_view_host_delegate.h" |
58 #include "content/public/browser/resource_context.h" | 58 #include "content/public/browser/resource_context.h" |
59 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 59 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
60 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 60 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
61 #include "content/public/browser/resource_throttle.h" | 61 #include "content/public/browser/resource_throttle.h" |
62 #include "content/public/common/content_switches.h" | 62 #include "content/public/common/content_switches.h" |
| 63 #include "content/public/common/content_url_request_user_data.h" |
63 #include "content/public/common/process_type.h" | 64 #include "content/public/common/process_type.h" |
64 #include "content/public/common/url_constants.h" | 65 #include "content/public/common/url_constants.h" |
65 #include "net/base/auth.h" | 66 #include "net/base/auth.h" |
66 #include "net/base/cert_status_flags.h" | 67 #include "net/base/cert_status_flags.h" |
67 #include "net/base/cookie_monster.h" | 68 #include "net/base/cookie_monster.h" |
68 #include "net/base/load_flags.h" | 69 #include "net/base/load_flags.h" |
69 #include "net/base/mime_util.h" | 70 #include "net/base/mime_util.h" |
70 #include "net/base/net_errors.h" | 71 #include "net/base/net_errors.h" |
71 #include "net/base/registry_controlled_domain.h" | 72 #include "net/base/registry_controlled_domain.h" |
72 #include "net/base/request_priority.h" | 73 #include "net/base/request_priority.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 request_id, throttles.Pass()); | 378 request_id, throttles.Pass()); |
378 } | 379 } |
379 } | 380 } |
380 return handler; | 381 return handler; |
381 } | 382 } |
382 | 383 |
383 void ResourceDispatcherHost::SetRequestInfo( | 384 void ResourceDispatcherHost::SetRequestInfo( |
384 net::URLRequest* request, | 385 net::URLRequest* request, |
385 ResourceDispatcherHostRequestInfo* info) { | 386 ResourceDispatcherHostRequestInfo* info) { |
386 request->SetUserData(NULL, info); | 387 request->SetUserData(NULL, info); |
| 388 request->SetUserData( |
| 389 content::ContentURLRequestUserData::kUserDataKey, |
| 390 new content::ContentURLRequestUserData( |
| 391 info->child_id(), info->route_id())); |
387 } | 392 } |
388 | 393 |
389 void ResourceDispatcherHost::OnShutdown() { | 394 void ResourceDispatcherHost::OnShutdown() { |
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
391 is_shutdown_ = true; | 396 is_shutdown_ = true; |
392 for (PendingRequestList::const_iterator i = pending_requests_.begin(); | 397 for (PendingRequestList::const_iterator i = pending_requests_.begin(); |
393 i != pending_requests_.end(); ++i) { | 398 i != pending_requests_.end(); ++i) { |
394 transferred_navigations_.erase(i->first); | 399 transferred_navigations_.erase(i->first); |
395 } | 400 } |
396 STLDeleteValues(&pending_requests_); | 401 STLDeleteValues(&pending_requests_); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 } | 1421 } |
1417 | 1422 |
1418 void ResourceDispatcherHost::OnSSLCertificateError( | 1423 void ResourceDispatcherHost::OnSSLCertificateError( |
1419 net::URLRequest* request, | 1424 net::URLRequest* request, |
1420 const net::SSLInfo& ssl_info, | 1425 const net::SSLInfo& ssl_info, |
1421 bool is_hsts_host) { | 1426 bool is_hsts_host) { |
1422 DCHECK(request); | 1427 DCHECK(request); |
1423 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); | 1428 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); |
1424 } | 1429 } |
1425 | 1430 |
1426 bool ResourceDispatcherHost::CanGetCookies( | |
1427 const net::URLRequest* request, | |
1428 const net::CookieList& cookie_list) const { | |
1429 VLOG(1) << "OnGetCookies: " << request->url().spec(); | |
1430 int render_process_id, render_view_id; | |
1431 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | |
1432 return false; | |
1433 | |
1434 const ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | |
1435 | |
1436 return content::GetContentClient()->browser()->AllowGetCookie( | |
1437 request->url(), request->first_party_for_cookies(), cookie_list, | |
1438 info->context(), render_process_id, render_view_id); | |
1439 } | |
1440 | |
1441 bool ResourceDispatcherHost::CanSetCookie(const net::URLRequest* request, | |
1442 const std::string& cookie_line, | |
1443 net::CookieOptions* options) const { | |
1444 VLOG(1) << "OnSetCookie: " << request->url().spec(); | |
1445 | |
1446 int render_process_id, render_view_id; | |
1447 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | |
1448 return false; | |
1449 | |
1450 const ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | |
1451 return content::GetContentClient()->browser()->AllowSetCookie( | |
1452 request->url(), request->first_party_for_cookies(), cookie_line, | |
1453 info->context(), render_process_id, render_view_id, options); | |
1454 } | |
1455 | |
1456 void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) { | 1431 void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) { |
1457 VLOG(1) << "OnResponseStarted: " << request->url().spec(); | 1432 VLOG(1) << "OnResponseStarted: " << request->url().spec(); |
1458 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1433 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
1459 | 1434 |
1460 if (request->status().is_success()) { | 1435 if (request->status().is_success()) { |
1461 if (PauseRequestIfNeeded(info)) { | 1436 if (PauseRequestIfNeeded(info)) { |
1462 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); | 1437 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); |
1463 return; | 1438 return; |
1464 } | 1439 } |
1465 | 1440 |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 scoped_refptr<ResourceHandler> transferred_resource_handler( | 2258 scoped_refptr<ResourceHandler> transferred_resource_handler( |
2284 new DoomedResourceHandler(info->resource_handler())); | 2259 new DoomedResourceHandler(info->resource_handler())); |
2285 info->set_resource_handler(transferred_resource_handler.get()); | 2260 info->set_resource_handler(transferred_resource_handler.get()); |
2286 } | 2261 } |
2287 | 2262 |
2288 bool ResourceDispatcherHost::IsTransferredNavigation( | 2263 bool ResourceDispatcherHost::IsTransferredNavigation( |
2289 const content::GlobalRequestID& transferred_request_id) const { | 2264 const content::GlobalRequestID& transferred_request_id) const { |
2290 return transferred_navigations_.find(transferred_request_id) != | 2265 return transferred_navigations_.find(transferred_request_id) != |
2291 transferred_navigations_.end(); | 2266 transferred_navigations_.end(); |
2292 } | 2267 } |
OLD | NEW |