 Chromium Code Reviews
 Chromium Code Reviews Issue 9406001:
  Factor out ResourceDispatcherHost dependent code around SSLManager  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 9406001:
  Factor out ResourceDispatcherHost dependent code around SSLManager  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 delegate_->DownloadStarting(request, context, child_id, route_id, | 373 delegate_->DownloadStarting(request, context, child_id, route_id, | 
| 374 request_id, !request->is_pending(), &throttles); | 374 request_id, !request->is_pending(), &throttles); | 
| 375 if (!throttles.empty()) { | 375 if (!throttles.empty()) { | 
| 376 handler = new ThrottlingResourceHandler(this, handler, child_id, | 376 handler = new ThrottlingResourceHandler(this, handler, child_id, | 
| 377 request_id, throttles.Pass()); | 377 request_id, throttles.Pass()); | 
| 378 } | 378 } | 
| 379 } | 379 } | 
| 380 return handler; | 380 return handler; | 
| 381 } | 381 } | 
| 382 | 382 | 
| 383 ResourceType::Type ResourceDispatcherHost::ResourceTypeForSSLRequest( | |
| 384 const GlobalRequestID& id) { | |
| 385 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 386 net::URLRequest* request = GetURLRequest(id); | |
| 387 DCHECK(request); | |
| 388 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | |
| 389 DCHECK(info); | |
| 390 return info->resource_type(); | |
| 391 } | |
| 392 | |
| 393 const GURL& ResourceDispatcherHost::URLForSSLRequest( | |
| 394 const GlobalRequestID& id) { | |
| 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 396 net::URLRequest* request = GetURLRequest(id); | |
| 397 DCHECK(request); | |
| 398 return request->url(); | |
| 399 } | |
| 400 | |
| 401 bool ResourceDispatcherHost::RenderViewForSSLRequest( | |
| 402 const GlobalRequestID& id, | |
| 403 int* render_process_host_id, | |
| 404 int* render_view_host_id) { | |
| 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 406 return RenderViewForRequest( | |
| 407 GetURLRequest(id), render_process_host_id, render_view_host_id); | |
| 408 } | |
| 409 | |
| 410 void ResourceDispatcherHost::CancelSSLRequest( | |
| 411 const GlobalRequestID& id, | |
| 412 int error, | |
| 413 const net::SSLInfo* ssl_info) { | |
| 414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 415 net::URLRequest* request = GetURLRequest(id); | |
| 416 // The request can be NULL if it was cancelled by the renderer (as the | |
| 417 // request of the user navigating to a new page from the location bar). | |
| 418 if (!request || !request->is_pending()) | |
| 
darin (slow to review)
2012/02/28 23:36:44
NOTE:  The request switches to no longer being pen
 
Takashi Toyoshima
2012/02/29 00:15:24
Can I keep this as is for now?
Do you mean pending
 | |
| 419 return; | |
| 420 DVLOG(1) << "CancelRequestForInstance() url: " << request->url().spec(); | |
| 421 if (ssl_info) | |
| 422 request->SimulateSSLError(error, *ssl_info); | |
| 423 else | |
| 424 request->SimulateError(error); | |
| 425 } | |
| 426 | |
| 427 void ResourceDispatcherHost::ContinueSSLRequest( | |
| 428 const GlobalRequestID& id) { | |
| 429 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 430 net::URLRequest* request = GetURLRequest(id); | |
| 431 // The request can be NULL if it was cancelled by the renderer (as the | |
| 432 // request of the user navigating to a new page from the location bar). | |
| 433 if (!request) | |
| 434 return; | |
| 435 DVLOG(1) << "ContinueRequestForInstance() url: " << request->url().spec(); | |
| 436 request->ContinueDespiteLastError(); | |
| 437 } | |
| 438 | |
| 383 void ResourceDispatcherHost::SetRequestInfo( | 439 void ResourceDispatcherHost::SetRequestInfo( | 
| 384 net::URLRequest* request, | 440 net::URLRequest* request, | 
| 385 ResourceDispatcherHostRequestInfo* info) { | 441 ResourceDispatcherHostRequestInfo* info) { | 
| 386 request->SetUserData(NULL, info); | 442 request->SetUserData(NULL, info); | 
| 387 } | 443 } | 
| 388 | 444 | 
| 389 void ResourceDispatcherHost::OnShutdown() { | 445 void ResourceDispatcherHost::OnShutdown() { | 
| 390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 
| 391 is_shutdown_ = true; | 447 is_shutdown_ = true; | 
| 392 for (PendingRequestList::const_iterator i = pending_requests_.begin(); | 448 for (PendingRequestList::const_iterator i = pending_requests_.begin(); | 
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 info->set_ssl_client_auth_handler( | 1469 info->set_ssl_client_auth_handler( | 
| 1414 new SSLClientAuthHandler(request, cert_request_info)); | 1470 new SSLClientAuthHandler(request, cert_request_info)); | 
| 1415 info->ssl_client_auth_handler()->SelectCertificate(); | 1471 info->ssl_client_auth_handler()->SelectCertificate(); | 
| 1416 } | 1472 } | 
| 1417 | 1473 | 
| 1418 void ResourceDispatcherHost::OnSSLCertificateError( | 1474 void ResourceDispatcherHost::OnSSLCertificateError( | 
| 1419 net::URLRequest* request, | 1475 net::URLRequest* request, | 
| 1420 const net::SSLInfo& ssl_info, | 1476 const net::SSLInfo& ssl_info, | 
| 1421 bool is_hsts_host) { | 1477 bool is_hsts_host) { | 
| 1422 DCHECK(request); | 1478 DCHECK(request); | 
| 1423 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); | 1479 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 
| 1480 DCHECK(info); | |
| 1481 GlobalRequestID request_id(info->child_id(), info->request_id()); | |
| 1482 SSLManager::OnSSLCertificateError(this, request_id, ssl_info, is_hsts_host); | |
| 1424 } | 1483 } | 
| 1425 | 1484 | 
| 1426 bool ResourceDispatcherHost::CanGetCookies( | 1485 bool ResourceDispatcherHost::CanGetCookies( | 
| 1427 const net::URLRequest* request, | 1486 const net::URLRequest* request, | 
| 1428 const net::CookieList& cookie_list) const { | 1487 const net::CookieList& cookie_list) const { | 
| 1429 VLOG(1) << "OnGetCookies: " << request->url().spec(); | 1488 VLOG(1) << "OnGetCookies: " << request->url().spec(); | 
| 1430 int render_process_id, render_view_id; | 1489 int render_process_id, render_view_id; | 
| 1431 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | 1490 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | 
| 1432 return false; | 1491 return false; | 
| 1433 | 1492 | 
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2283 scoped_refptr<ResourceHandler> transferred_resource_handler( | 2342 scoped_refptr<ResourceHandler> transferred_resource_handler( | 
| 2284 new DoomedResourceHandler(info->resource_handler())); | 2343 new DoomedResourceHandler(info->resource_handler())); | 
| 2285 info->set_resource_handler(transferred_resource_handler.get()); | 2344 info->set_resource_handler(transferred_resource_handler.get()); | 
| 2286 } | 2345 } | 
| 2287 | 2346 | 
| 2288 bool ResourceDispatcherHost::IsTransferredNavigation( | 2347 bool ResourceDispatcherHost::IsTransferredNavigation( | 
| 2289 const content::GlobalRequestID& transferred_request_id) const { | 2348 const content::GlobalRequestID& transferred_request_id) const { | 
| 2290 return transferred_navigations_.find(transferred_request_id) != | 2349 return transferred_navigations_.find(transferred_request_id) != | 
| 2291 transferred_navigations_.end(); | 2350 transferred_navigations_.end(); | 
| 2292 } | 2351 } | 
| OLD | NEW |