Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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/process_type.h" | 63 #include "content/public/common/process_type.h" |
| 64 #include "content/public/common/url_constants.h" | 64 #include "content/public/common/url_constants.h" |
| 65 #include "content/public/common/url_request_user_data.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" |
| 73 #include "net/base/ssl_cert_request_info.h" | 74 #include "net/base/ssl_cert_request_info.h" |
| 74 #include "net/base/upload_data.h" | 75 #include "net/base/upload_data.h" |
| (...skipping 302 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::URLRequestUserData::kUserDataKey, | |
| 390 new content::URLRequestUserData(info->child_id(), info->route_id())); | |
| 387 } | 391 } |
| 388 | 392 |
| 389 void ResourceDispatcherHost::OnShutdown() { | 393 void ResourceDispatcherHost::OnShutdown() { |
| 390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 394 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 391 is_shutdown_ = true; | 395 is_shutdown_ = true; |
| 392 for (PendingRequestList::const_iterator i = pending_requests_.begin(); | 396 for (PendingRequestList::const_iterator i = pending_requests_.begin(); |
| 393 i != pending_requests_.end(); ++i) { | 397 i != pending_requests_.end(); ++i) { |
| 394 transferred_navigations_.erase(i->first); | 398 transferred_navigations_.erase(i->first); |
| 395 } | 399 } |
| 396 STLDeleteValues(&pending_requests_); | 400 STLDeleteValues(&pending_requests_); |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 } | 1420 } |
| 1417 | 1421 |
| 1418 void ResourceDispatcherHost::OnSSLCertificateError( | 1422 void ResourceDispatcherHost::OnSSLCertificateError( |
| 1419 net::URLRequest* request, | 1423 net::URLRequest* request, |
| 1420 const net::SSLInfo& ssl_info, | 1424 const net::SSLInfo& ssl_info, |
| 1421 bool is_hsts_host) { | 1425 bool is_hsts_host) { |
| 1422 DCHECK(request); | 1426 DCHECK(request); |
| 1423 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); | 1427 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); |
| 1424 } | 1428 } |
| 1425 | 1429 |
| 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( | |
|
cbentzel
2012/03/05 12:56:12
You should be able to remove AllowGetCookie/AllowS
jam
2012/03/05 19:11:03
really? it would be great if we can remove them, b
jochen (gone - plz use gerrit)
2012/03/06 18:39:54
Yes, the WebSocket implementation still uses it (n
willchan no longer on Chromium
2012/03/06 18:42:29
FWIW, we're merging the WebSocket implementation w
| |
| 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) { | 1430 void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) { |
| 1457 VLOG(1) << "OnResponseStarted: " << request->url().spec(); | 1431 VLOG(1) << "OnResponseStarted: " << request->url().spec(); |
| 1458 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1432 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 1459 | 1433 |
| 1460 if (request->status().is_success()) { | 1434 if (request->status().is_success()) { |
| 1461 if (PauseRequestIfNeeded(info)) { | 1435 if (PauseRequestIfNeeded(info)) { |
| 1462 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); | 1436 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); |
| 1463 return; | 1437 return; |
| 1464 } | 1438 } |
| 1465 | 1439 |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2283 scoped_refptr<ResourceHandler> transferred_resource_handler( | 2257 scoped_refptr<ResourceHandler> transferred_resource_handler( |
| 2284 new DoomedResourceHandler(info->resource_handler())); | 2258 new DoomedResourceHandler(info->resource_handler())); |
| 2285 info->set_resource_handler(transferred_resource_handler.get()); | 2259 info->set_resource_handler(transferred_resource_handler.get()); |
| 2286 } | 2260 } |
| 2287 | 2261 |
| 2288 bool ResourceDispatcherHost::IsTransferredNavigation( | 2262 bool ResourceDispatcherHost::IsTransferredNavigation( |
| 2289 const content::GlobalRequestID& transferred_request_id) const { | 2263 const content::GlobalRequestID& transferred_request_id) const { |
| 2290 return transferred_navigations_.find(transferred_request_id) != | 2264 return transferred_navigations_.find(transferred_request_id) != |
| 2291 transferred_navigations_.end(); | 2265 transferred_navigations_.end(); |
| 2292 } | 2266 } |
| OLD | NEW |