| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 561 } |
| 562 | 562 |
| 563 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( | 563 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( |
| 564 net::URLRequest* request, | 564 net::URLRequest* request, |
| 565 content::ResourceContext* resource_context, | 565 content::ResourceContext* resource_context, |
| 566 content::ResourceResponse* response, | 566 content::ResourceResponse* response, |
| 567 IPC::Sender* sender) { | 567 IPC::Sender* sender) { |
| 568 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 568 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 569 | 569 |
| 570 if (request->url().SchemeIsSecure()) { | 570 if (request->url().SchemeIsSecure()) { |
| 571 const net::URLRequestContext* context = request->context(); | 571 if (request->GetHSTSRedirect(NULL)) { |
| 572 net::TransportSecurityState* state = context->transport_security_state(); | |
| 573 if (state) { | |
| 574 net::TransportSecurityState::DomainState domain_state; | |
| 575 bool has_sni = net::SSLConfigService::IsSNIAvailable( | |
| 576 context->ssl_config_service()); | |
| 577 if (state->GetDomainState(request->url().host(), has_sni, | |
| 578 &domain_state) && | |
| 579 domain_state.ShouldUpgradeToSSL()) { | |
| 580 sender->Send(new ChromeViewMsg_AddStrictSecurityHost( | 572 sender->Send(new ChromeViewMsg_AddStrictSecurityHost( |
| 581 info->GetRouteID(), request->url().host())); | 573 info->GetRouteID(), request->url().host())); |
| 582 } | |
| 583 } | 574 } |
| 584 } | 575 } |
| 585 | 576 |
| 586 // See if the response contains the X-Auto-Login header. If so, this was | 577 // See if the response contains the X-Auto-Login header. If so, this was |
| 587 // a request for a login page, and the server is allowing the browser to | 578 // a request for a login page, and the server is allowing the browser to |
| 588 // suggest auto-login, if available. | 579 // suggest auto-login, if available. |
| 589 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(), | 580 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(), |
| 590 info->GetRouteID()); | 581 info->GetRouteID()); |
| 591 | 582 |
| 592 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 583 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && | 636 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && |
| 646 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | 637 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( |
| 647 &child_id, &route_id) && | 638 &child_id, &route_id) && |
| 648 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { | 639 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { |
| 649 ReportUnsupportedPrerenderScheme(redirect_url); | 640 ReportUnsupportedPrerenderScheme(redirect_url); |
| 650 prerender_tracker_->TryCancel( | 641 prerender_tracker_->TryCancel( |
| 651 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); | 642 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); |
| 652 request->Cancel(); | 643 request->Cancel(); |
| 653 } | 644 } |
| 654 } | 645 } |
| OLD | NEW |