| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 expected_content_size, render_process_id, render_view_id, | 490 expected_content_size, render_process_id, render_view_id, |
| 491 target_id)); | 491 target_id)); |
| 492 #endif | 492 #endif |
| 493 } | 493 } |
| 494 | 494 |
| 495 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( | 495 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( |
| 496 net::URLRequest* request, | 496 net::URLRequest* request, |
| 497 content::ResourceContext* resource_context, | 497 content::ResourceContext* resource_context, |
| 498 content::ResourceResponse* response, | 498 content::ResourceResponse* response, |
| 499 IPC::Sender* sender) { | 499 IPC::Sender* sender) { |
| 500 // TODO(mmenke): Figure out if LOAD_ENABLE_LOAD_TIMING is safe to remove. | |
| 501 if (request->load_flags() & net::LOAD_ENABLE_LOAD_TIMING) | |
| 502 request->GetLoadTimingInfo(&response->head.load_timing); | |
| 503 | |
| 504 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 500 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 505 | 501 |
| 506 if (request->url().SchemeIsSecure()) { | 502 if (request->url().SchemeIsSecure()) { |
| 507 const net::URLRequestContext* context = request->context(); | 503 const net::URLRequestContext* context = request->context(); |
| 508 net::TransportSecurityState* state = context->transport_security_state(); | 504 net::TransportSecurityState* state = context->transport_security_state(); |
| 509 if (state) { | 505 if (state) { |
| 510 net::TransportSecurityState::DomainState domain_state; | 506 net::TransportSecurityState::DomainState domain_state; |
| 511 bool has_sni = net::SSLConfigService::IsSNIAvailable( | 507 bool has_sni = net::SSLConfigService::IsSNIAvailable( |
| 512 context->ssl_config_service()); | 508 context->ssl_config_service()); |
| 513 if (state->GetDomainState(request->url().host(), has_sni, | 509 if (state->GetDomainState(request->url().host(), has_sni, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 io_data->resource_prefetch_predictor_observer()->OnResponseStarted(request); | 547 io_data->resource_prefetch_predictor_observer()->OnResponseStarted(request); |
| 552 | 548 |
| 553 prerender::URLRequestResponseStarted(request); | 549 prerender::URLRequestResponseStarted(request); |
| 554 } | 550 } |
| 555 | 551 |
| 556 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 552 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
| 557 const GURL& redirect_url, | 553 const GURL& redirect_url, |
| 558 net::URLRequest* request, | 554 net::URLRequest* request, |
| 559 content::ResourceContext* resource_context, | 555 content::ResourceContext* resource_context, |
| 560 content::ResourceResponse* response) { | 556 content::ResourceResponse* response) { |
| 561 // TODO(mmenke): Figure out if LOAD_ENABLE_LOAD_TIMING is safe to remove. | |
| 562 if (request->load_flags() & net::LOAD_ENABLE_LOAD_TIMING) | |
| 563 request->GetLoadTimingInfo(&response->head.load_timing); | |
| 564 | |
| 565 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 557 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
| 566 | 558 |
| 567 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 559 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 568 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 560 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 569 | 561 |
| 570 // See if the response contains the Google-Accounts-SignIn header. If so, | 562 // See if the response contains the Google-Accounts-SignIn header. If so, |
| 571 // then the user has just finished signing in, and the server is allowing the | 563 // then the user has just finished signing in, and the server is allowing the |
| 572 // browser to suggest connecting the user's profile to the account. | 564 // browser to suggest connecting the user's profile to the account. |
| 573 OneClickSigninHelper::ShowInfoBarIfPossible(request, io_data, | 565 OneClickSigninHelper::ShowInfoBarIfPossible(request, io_data, |
| 574 info->GetChildID(), | 566 info->GetChildID(), |
| 575 info->GetRouteID()); | 567 info->GetRouteID()); |
| 576 AppendChromeSyncGaiaHeader(request, resource_context); | 568 AppendChromeSyncGaiaHeader(request, resource_context); |
| 577 #endif | 569 #endif |
| 578 | 570 |
| 579 if (io_data->resource_prefetch_predictor_observer()) { | 571 if (io_data->resource_prefetch_predictor_observer()) { |
| 580 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( | 572 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( |
| 581 redirect_url, request); | 573 redirect_url, request); |
| 582 } | 574 } |
| 583 | 575 |
| 584 int child_id, route_id; | 576 int child_id, route_id; |
| 585 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && | 577 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && |
| 586 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | 578 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( |
| 587 &child_id, &route_id) && | 579 &child_id, &route_id) && |
| 588 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { | 580 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { |
| 589 prerender_tracker_->TryCancel( | 581 prerender_tracker_->TryCancel( |
| 590 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); | 582 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); |
| 591 request->Cancel(); | 583 request->Cancel(); |
| 592 } | 584 } |
| 593 } | 585 } |
| OLD | NEW |