| 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 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // If this isn't a new request, we've seen this before and added the standard | 375 // If this isn't a new request, we've seen this before and added the standard |
| 376 // resource throttles already so no need to add it again. | 376 // resource throttles already so no need to add it again. |
| 377 if (!request->is_pending()) { | 377 if (!request->is_pending()) { |
| 378 AppendStandardResourceThrottles(request, | 378 AppendStandardResourceThrottles(request, |
| 379 resource_context, | 379 resource_context, |
| 380 ResourceType::MAIN_FRAME, | 380 ResourceType::MAIN_FRAME, |
| 381 throttles); | 381 throttles); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 bool ChromeResourceDispatcherHostDelegate::AcceptSSLClientCertificateRequest( | |
| 386 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { | |
| 387 if (request->load_flags() & net::LOAD_PREFETCH) | |
| 388 return false; | |
| 389 | |
| 390 ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request); | |
| 391 if (user_data && user_data->is_prerender()) { | |
| 392 int child_id, route_id; | |
| 393 if (ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | |
| 394 &child_id, &route_id)) { | |
| 395 if (prerender_tracker_->TryCancel( | |
| 396 child_id, route_id, | |
| 397 prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED)) { | |
| 398 return false; | |
| 399 } | |
| 400 } | |
| 401 } | |
| 402 | |
| 403 return true; | |
| 404 } | |
| 405 | |
| 406 bool ChromeResourceDispatcherHostDelegate::AcceptAuthRequest( | |
| 407 net::URLRequest* request, | |
| 408 net::AuthChallengeInfo* auth_info) { | |
| 409 ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request); | |
| 410 if (!user_data || !user_data->is_prerender()) | |
| 411 return true; | |
| 412 | |
| 413 int child_id, route_id; | |
| 414 if (!ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | |
| 415 &child_id, &route_id)) { | |
| 416 NOTREACHED(); | |
| 417 return true; | |
| 418 } | |
| 419 | |
| 420 if (!prerender_tracker_->TryCancelOnIOThread( | |
| 421 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { | |
| 422 return true; | |
| 423 } | |
| 424 | |
| 425 return false; | |
| 426 } | |
| 427 | |
| 428 ResourceDispatcherHostLoginDelegate* | 385 ResourceDispatcherHostLoginDelegate* |
| 429 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 386 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
| 430 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 387 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { |
| 431 return CreateLoginPrompt(auth_info, request); | 388 return CreateLoginPrompt(auth_info, request); |
| 432 } | 389 } |
| 433 | 390 |
| 434 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 391 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
| 435 const GURL& url, int child_id, int route_id) { | 392 const GURL& url, int child_id, int route_id) { |
| 436 #if defined(OS_ANDROID) | 393 #if defined(OS_ANDROID) |
| 437 // Android use a resource throttle to handle external as well as internal | 394 // Android use a resource throttle to handle external as well as internal |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 // exception is requests from gaia webview, since the native profile | 616 // exception is requests from gaia webview, since the native profile |
| 660 // management UI is built on top of it. | 617 // management UI is built on top of it. |
| 661 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, | 618 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, |
| 662 info->GetChildID(), info->GetRouteID()); | 619 info->GetChildID(), info->GetRouteID()); |
| 663 | 620 |
| 664 if (io_data->resource_prefetch_predictor_observer()) { | 621 if (io_data->resource_prefetch_predictor_observer()) { |
| 665 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( | 622 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( |
| 666 redirect_url, request); | 623 redirect_url, request); |
| 667 } | 624 } |
| 668 } | 625 } |
| OLD | NEW |