Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 9406001: Factor out ResourceDispatcherHost dependent code around SSLManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflects wtc's review Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 delegate_->DownloadStarting(request, context, child_id, route_id, 382 delegate_->DownloadStarting(request, context, child_id, route_id,
383 request_id, !request->is_pending(), &throttles); 383 request_id, !request->is_pending(), &throttles);
384 if (!throttles.empty()) { 384 if (!throttles.empty()) {
385 handler = new ThrottlingResourceHandler(this, handler, child_id, 385 handler = new ThrottlingResourceHandler(this, handler, child_id,
386 request_id, throttles.Pass()); 386 request_id, throttles.Pass());
387 } 387 }
388 } 388 }
389 return handler; 389 return handler;
390 } 390 }
391 391
392 ResourceType::Type ResourceDispatcherHost::ResourceTypeForSSLRequest(
393 const GlobalRequestID& id) {
394 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
395 net::URLRequest* request = GetURLRequest(id);
396 DCHECK(request);
397 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
398 DCHECK(info);
399 return info->resource_type();
400 }
401
402 const GURL& ResourceDispatcherHost::URLForSSLRequest(
403 const GlobalRequestID& id) {
404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
405 net::URLRequest* request = GetURLRequest(id);
406 DCHECK(request);
407 return request->url();
408 }
409
410 bool ResourceDispatcherHost::RenderViewForSSLRequest(
411 const GlobalRequestID& id,
412 int* render_process_host_id,
413 int* render_view_host_id) {
414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
415 return RenderViewForRequest(
416 GetURLRequest(id), render_process_host_id, render_view_host_id);
417 }
418
419 void ResourceDispatcherHost::CancelSSLRequest(
420 const GlobalRequestID& id,
421 int error,
422 const net::SSLInfo* ssl_info) {
423 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
424 net::URLRequest* request = GetURLRequest(id);
425 // The request can be NULL if it was cancelled by the renderer (as the
426 // request of the user navigating to a new page from the location bar).
427 if (!request)
428 return;
429 DVLOG(1) << "CancelRequestForInstance() url: " << request->url().spec();
430 if (ssl_info)
431 request->SimulateSSLError(error, *ssl_info);
432 else
433 request->SimulateError(error);
434 }
435
436 void ResourceDispatcherHost::ContinueSSLRequest(
437 const GlobalRequestID& id) {
438 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
439 net::URLRequest* request = GetURLRequest(id);
440 // The request can be NULL if it was cancelled by the renderer (as the
441 // request of the user navigating to a new page from the location bar).
442 if (!request)
443 return;
444 DVLOG(1) << "ContinueRequestForInstance() url: " << request->url().spec();
445 request->ContinueDespiteLastError();
446 }
447
392 void ResourceDispatcherHost::SetRequestInfo( 448 void ResourceDispatcherHost::SetRequestInfo(
393 net::URLRequest* request, 449 net::URLRequest* request,
394 ResourceDispatcherHostRequestInfo* info) { 450 ResourceDispatcherHostRequestInfo* info) {
395 request->SetUserData(NULL, info); 451 request->SetUserData(NULL, info);
396 } 452 }
397 453
398 void ResourceDispatcherHost::OnShutdown() { 454 void ResourceDispatcherHost::OnShutdown() {
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
400 is_shutdown_ = true; 456 is_shutdown_ = true;
401 resource_queue_.Shutdown(); 457 resource_queue_.Shutdown();
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 info->set_ssl_client_auth_handler( 1478 info->set_ssl_client_auth_handler(
1423 new SSLClientAuthHandler(request, cert_request_info)); 1479 new SSLClientAuthHandler(request, cert_request_info));
1424 info->ssl_client_auth_handler()->SelectCertificate(); 1480 info->ssl_client_auth_handler()->SelectCertificate();
1425 } 1481 }
1426 1482
1427 void ResourceDispatcherHost::OnSSLCertificateError( 1483 void ResourceDispatcherHost::OnSSLCertificateError(
1428 net::URLRequest* request, 1484 net::URLRequest* request,
1429 const net::SSLInfo& ssl_info, 1485 const net::SSLInfo& ssl_info,
1430 bool is_hsts_host) { 1486 bool is_hsts_host) {
1431 DCHECK(request); 1487 DCHECK(request);
1432 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); 1488 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
1489 DCHECK(info);
1490 GlobalRequestID request_id(info->child_id(), info->request_id());
1491 SSLManager::OnSSLCertificateError(this, request_id, ssl_info, is_hsts_host);
1433 } 1492 }
1434 1493
1435 bool ResourceDispatcherHost::CanGetCookies( 1494 bool ResourceDispatcherHost::CanGetCookies(
1436 const net::URLRequest* request, 1495 const net::URLRequest* request,
1437 const net::CookieList& cookie_list) const { 1496 const net::CookieList& cookie_list) const {
1438 VLOG(1) << "OnGetCookies: " << request->url().spec(); 1497 VLOG(1) << "OnGetCookies: " << request->url().spec();
1439 int render_process_id, render_view_id; 1498 int render_process_id, render_view_id;
1440 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) 1499 if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
1441 return false; 1500 return false;
1442 1501
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 scoped_refptr<ResourceHandler> transferred_resource_handler( 2360 scoped_refptr<ResourceHandler> transferred_resource_handler(
2302 new DoomedResourceHandler(info->resource_handler())); 2361 new DoomedResourceHandler(info->resource_handler()));
2303 info->set_resource_handler(transferred_resource_handler.get()); 2362 info->set_resource_handler(transferred_resource_handler.get());
2304 } 2363 }
2305 2364
2306 bool ResourceDispatcherHost::IsTransferredNavigation( 2365 bool ResourceDispatcherHost::IsTransferredNavigation(
2307 const content::GlobalRequestID& transferred_request_id) const { 2366 const content::GlobalRequestID& transferred_request_id) const {
2308 return transferred_navigations_.find(transferred_request_id) != 2367 return transferred_navigations_.find(transferred_request_id) !=
2309 transferred_navigations_.end(); 2368 transferred_navigations_.end();
2310 } 2369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698