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