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

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 darin's review Created 8 years, 9 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void ResourceDispatcherHost::CancelSSLRequest(
384 const GlobalRequestID& id,
385 int error,
386 const net::SSLInfo* ssl_info) {
387 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
388 net::URLRequest* request = GetURLRequest(id);
389 // The request can be NULL if it was cancelled by the renderer (as the
390 // request of the user navigating to a new page from the location bar).
391 if (!request || !request->is_pending())
392 return;
393 DVLOG(1) << "CancelRequestForInstance() url: " << request->url().spec();
darin (slow to review) 2012/03/09 20:49:03 nit: the log comment seems to implicate a function
Takashi Toyoshima 2012/03/10 00:24:44 Oops, sorry for mistakes. Fixed.
394 if (ssl_info)
395 request->SimulateSSLError(error, *ssl_info);
darin (slow to review) 2012/03/09 20:49:03 the ResourceDispatcherHost has so many other Cance
Takashi Toyoshima 2012/03/10 00:24:44 I'm looking into url_request.h. It has Start(), Ca
396 else
397 request->SimulateError(error);
398 }
399
400 void ResourceDispatcherHost::ContinueSSLRequest(
401 const GlobalRequestID& id) {
402 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
403 net::URLRequest* request = GetURLRequest(id);
404 // The request can be NULL if it was cancelled by the renderer (as the
405 // request of the user navigating to a new page from the location bar).
406 if (!request)
407 return;
408 DVLOG(1) << "ContinueRequestForInstance() url: " << request->url().spec();
Takashi Toyoshima 2012/03/10 00:24:44 Same mistake here. Done.
409 request->ContinueDespiteLastError();
410 }
411
383 void ResourceDispatcherHost::SetRequestInfo( 412 void ResourceDispatcherHost::SetRequestInfo(
384 net::URLRequest* request, 413 net::URLRequest* request,
385 ResourceDispatcherHostRequestInfo* info) { 414 ResourceDispatcherHostRequestInfo* info) {
386 request->SetUserData(NULL, info); 415 request->SetUserData(NULL, info);
387 } 416 }
388 417
389 void ResourceDispatcherHost::OnShutdown() { 418 void ResourceDispatcherHost::OnShutdown() {
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 419 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
391 is_shutdown_ = true; 420 is_shutdown_ = true;
392 for (PendingRequestList::const_iterator i = pending_requests_.begin(); 421 for (PendingRequestList::const_iterator i = pending_requests_.begin();
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 info->set_ssl_client_auth_handler( 1442 info->set_ssl_client_auth_handler(
1414 new SSLClientAuthHandler(request, cert_request_info)); 1443 new SSLClientAuthHandler(request, cert_request_info));
1415 info->ssl_client_auth_handler()->SelectCertificate(); 1444 info->ssl_client_auth_handler()->SelectCertificate();
1416 } 1445 }
1417 1446
1418 void ResourceDispatcherHost::OnSSLCertificateError( 1447 void ResourceDispatcherHost::OnSSLCertificateError(
1419 net::URLRequest* request, 1448 net::URLRequest* request,
1420 const net::SSLInfo& ssl_info, 1449 const net::SSLInfo& ssl_info,
1421 bool is_hsts_host) { 1450 bool is_hsts_host) {
1422 DCHECK(request); 1451 DCHECK(request);
1423 SSLManager::OnSSLCertificateError(this, request, ssl_info, is_hsts_host); 1452 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
1453 DCHECK(info);
1454 GlobalRequestID request_id(info->child_id(), info->request_id());
1455 int render_process_id;
1456 int render_view_id;
1457 if(!RenderViewForRequest(request, &render_process_id, &render_view_id))
darin (slow to review) 2012/03/09 20:49:03 since you already have |info|, please just use the
Takashi Toyoshima 2012/03/10 00:24:44 Applied with rebase. Done.
1458 NOTREACHED();
1459 SSLManager::OnSSLCertificateError(this, request_id, info->resource_type(),
1460 request->url(), render_process_id, render_view_id, ssl_info,
1461 is_hsts_host);
1424 } 1462 }
1425 1463
1426 bool ResourceDispatcherHost::CanGetCookies( 1464 bool ResourceDispatcherHost::CanGetCookies(
1427 const net::URLRequest* request, 1465 const net::URLRequest* request,
1428 const net::CookieList& cookie_list) const { 1466 const net::CookieList& cookie_list) const {
1429 VLOG(1) << "OnGetCookies: " << request->url().spec(); 1467 VLOG(1) << "OnGetCookies: " << request->url().spec();
1430 int render_process_id, render_view_id; 1468 int render_process_id, render_view_id;
1431 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) 1469 if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
1432 return false; 1470 return false;
1433 1471
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 scoped_refptr<ResourceHandler> transferred_resource_handler( 2321 scoped_refptr<ResourceHandler> transferred_resource_handler(
2284 new DoomedResourceHandler(info->resource_handler())); 2322 new DoomedResourceHandler(info->resource_handler()));
2285 info->set_resource_handler(transferred_resource_handler.get()); 2323 info->set_resource_handler(transferred_resource_handler.get());
2286 } 2324 }
2287 2325
2288 bool ResourceDispatcherHost::IsTransferredNavigation( 2326 bool ResourceDispatcherHost::IsTransferredNavigation(
2289 const content::GlobalRequestID& transferred_request_id) const { 2327 const content::GlobalRequestID& transferred_request_id) const {
2290 return transferred_navigations_.find(transferred_request_id) != 2328 return transferred_navigations_.find(transferred_request_id) !=
2291 transferred_navigations_.end(); 2329 transferred_navigations_.end();
2292 } 2330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698