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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 560 } |
561 return handler.Pass(); | 561 return handler.Pass(); |
562 } | 562 } |
563 | 563 |
564 scoped_ptr<ResourceHandler> | 564 scoped_ptr<ResourceHandler> |
565 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, | 565 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, |
566 ResourceResponse* response) { | 566 ResourceResponse* response) { |
567 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 567 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
568 const std::string& mime_type = response->head.mime_type; | 568 const std::string& mime_type = response->head.mime_type; |
569 | 569 |
570 GURL security_origin; | 570 GURL origin; |
571 std::string target_id; | 571 std::string target_id; |
572 if (!delegate_ || | 572 if (!delegate_ || |
573 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), | 573 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), |
574 request->url(), | 574 request->url(), |
575 mime_type, | 575 mime_type, |
576 &security_origin, | 576 &origin, |
577 &target_id)) { | 577 &target_id)) { |
578 return scoped_ptr<ResourceHandler>(); | 578 return scoped_ptr<ResourceHandler>(); |
579 } | 579 } |
580 | 580 |
581 StreamContext* stream_context = | 581 StreamContext* stream_context = |
582 GetStreamContextForResourceContext(info->GetContext()); | 582 GetStreamContextForResourceContext(info->GetContext()); |
583 | 583 |
584 | |
585 scoped_ptr<StreamResourceHandler> handler( | 584 scoped_ptr<StreamResourceHandler> handler( |
586 new StreamResourceHandler(request, | 585 new StreamResourceHandler(request, |
587 stream_context->registry(), | 586 stream_context->registry(), |
588 security_origin)); | 587 origin)); |
589 | 588 |
590 info->set_is_stream(true); | 589 info->set_is_stream(true); |
591 delegate_->OnStreamCreated( | 590 delegate_->OnStreamCreated( |
592 info->GetContext(), | 591 info->GetContext(), |
593 info->GetChildID(), | 592 info->GetChildID(), |
594 info->GetRouteID(), | 593 info->GetRouteID(), |
595 target_id, | 594 target_id, |
596 handler->stream()->CreateHandle(request->url(), mime_type), | 595 handler->stream()->CreateHandle(request->url(), mime_type), |
597 request->GetExpectedContentSize()); | 596 request->GetExpectedContentSize()); |
598 return (scoped_ptr<ResourceHandler>(handler.release())).Pass(); | 597 return handler.PassAs<ResourceHandler>(); |
599 } | 598 } |
600 | 599 |
601 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( | 600 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( |
602 net::URLRequest* request) { | 601 net::URLRequest* request) { |
603 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 602 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
604 if (info) { | 603 if (info) { |
605 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); | 604 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); |
606 if (loader) | 605 if (loader) |
607 loader->ClearSSLClientAuthHandler(); | 606 loader->ClearSSLClientAuthHandler(); |
608 } | 607 } |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1871 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
1873 && !policy->CanReadRawCookies(child_id)) { | 1872 && !policy->CanReadRawCookies(child_id)) { |
1874 VLOG(1) << "Denied unauthorized request for raw headers"; | 1873 VLOG(1) << "Denied unauthorized request for raw headers"; |
1875 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1874 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
1876 } | 1875 } |
1877 | 1876 |
1878 return load_flags; | 1877 return load_flags; |
1879 } | 1878 } |
1880 | 1879 |
1881 } // namespace content | 1880 } // namespace content |
OLD | NEW |