| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // If this isn't a new request, we've seen this before and added the standard | 388 // If this isn't a new request, we've seen this before and added the standard |
| 389 // resource throttles already so no need to add it again. | 389 // resource throttles already so no need to add it again. |
| 390 if (!request->is_pending()) { | 390 if (!request->is_pending()) { |
| 391 AppendStandardResourceThrottles(request, | 391 AppendStandardResourceThrottles(request, |
| 392 resource_context, | 392 resource_context, |
| 393 ResourceType::MAIN_FRAME, | 393 ResourceType::MAIN_FRAME, |
| 394 throttles); | 394 throttles); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 bool ChromeResourceDispatcherHostDelegate::AcceptSSLClientCertificateRequest( | |
| 399 net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { | |
| 400 if (request->load_flags() & net::LOAD_PREFETCH) | |
| 401 return false; | |
| 402 | |
| 403 ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request); | |
| 404 if (user_data && user_data->is_prerender()) { | |
| 405 int child_id, route_id; | |
| 406 if (ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | |
| 407 &child_id, &route_id)) { | |
| 408 if (prerender_tracker_->TryCancel( | |
| 409 child_id, route_id, | |
| 410 prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED)) { | |
| 411 return false; | |
| 412 } | |
| 413 } | |
| 414 } | |
| 415 | |
| 416 return true; | |
| 417 } | |
| 418 | |
| 419 bool ChromeResourceDispatcherHostDelegate::AcceptAuthRequest( | |
| 420 net::URLRequest* request, | |
| 421 net::AuthChallengeInfo* auth_info) { | |
| 422 ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request); | |
| 423 if (!user_data || !user_data->is_prerender()) | |
| 424 return true; | |
| 425 | |
| 426 int child_id, route_id; | |
| 427 if (!ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | |
| 428 &child_id, &route_id)) { | |
| 429 NOTREACHED(); | |
| 430 return true; | |
| 431 } | |
| 432 | |
| 433 if (!prerender_tracker_->TryCancelOnIOThread( | |
| 434 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { | |
| 435 return true; | |
| 436 } | |
| 437 | |
| 438 return false; | |
| 439 } | |
| 440 | |
| 441 ResourceDispatcherHostLoginDelegate* | 398 ResourceDispatcherHostLoginDelegate* |
| 442 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 399 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
| 443 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 400 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { |
| 444 return CreateLoginPrompt(auth_info, request); | 401 return CreateLoginPrompt(auth_info, request); |
| 445 } | 402 } |
| 446 | 403 |
| 447 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 404 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
| 448 const GURL& url, int child_id, int route_id) { | 405 const GURL& url, int child_id, int route_id) { |
| 449 #if defined(OS_ANDROID) | 406 #if defined(OS_ANDROID) |
| 450 // Android use a resource throttle to handle external as well as internal | 407 // Android use a resource throttle to handle external as well as internal |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 #endif | 614 #endif |
| 658 | 615 |
| 659 // In the Mirror world, Chrome should append a X-Chrome-Connected header to | 616 // In the Mirror world, Chrome should append a X-Chrome-Connected header to |
| 660 // all Gaia requests from a connected profile so Gaia could return a 204 | 617 // all Gaia requests from a connected profile so Gaia could return a 204 |
| 661 // response and let Chrome handle the action with native UI. The only | 618 // response and let Chrome handle the action with native UI. The only |
| 662 // exception is requests from gaia webview, since the native profile | 619 // exception is requests from gaia webview, since the native profile |
| 663 // management UI is built on top of it. | 620 // management UI is built on top of it. |
| 664 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, | 621 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, |
| 665 info->GetChildID(), info->GetRouteID()); | 622 info->GetChildID(), info->GetRouteID()); |
| 666 } | 623 } |
| OLD | NEW |