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 <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 ResourceDispatcherHostLoginDelegate* | 658 ResourceDispatcherHostLoginDelegate* |
659 ResourceDispatcherHostImpl::CreateLoginDelegate( | 659 ResourceDispatcherHostImpl::CreateLoginDelegate( |
660 ResourceLoader* loader, | 660 ResourceLoader* loader, |
661 net::AuthChallengeInfo* auth_info) { | 661 net::AuthChallengeInfo* auth_info) { |
662 if (!delegate_) | 662 if (!delegate_) |
663 return NULL; | 663 return NULL; |
664 | 664 |
665 return delegate_->CreateLoginDelegate(auth_info, loader->request()); | 665 return delegate_->CreateLoginDelegate(auth_info, loader->request()); |
666 } | 666 } |
667 | 667 |
668 bool RequestHasRecentUserGesture(const net::URLRequest* request) { | |
669 return (request->load_flags() & net::LOAD_MAYBE_USER_GESTURE) != 0; | |
not at google - send to devlin
2014/03/28 18:54:23
i can't really comment on the changes to this file
| |
670 } | |
671 | |
668 bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader, | 672 bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader, |
669 const GURL& url) { | 673 const GURL& url) { |
670 if (!delegate_) | 674 if (!delegate_) |
671 return false; | 675 return false; |
672 | 676 |
673 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 677 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
674 | 678 |
675 if (!ResourceType::IsFrame(info->GetResourceType())) | 679 if (!ResourceType::IsFrame(info->GetResourceType())) |
676 return false; | 680 return false; |
677 | 681 |
678 const net::URLRequestJobFactory* job_factory = | 682 const net::URLRequestJobFactory* job_factory = |
679 info->GetContext()->GetRequestContext()->job_factory(); | 683 info->GetContext()->GetRequestContext()->job_factory(); |
680 if (job_factory->IsHandledURL(url)) | 684 if (job_factory->IsHandledURL(url)) |
681 return false; | 685 return false; |
682 | 686 |
683 return delegate_->HandleExternalProtocol(url, info->GetChildID(), | 687 bool user_gesture = RequestHasRecentUserGesture(loader->request()); |
684 info->GetRouteID()); | 688 bool handled = delegate_->HandleExternalProtocol(url, info->GetChildID(), |
689 info->GetRouteID(), | |
690 user_gesture); | |
691 // Consume the user gesture if the external protocol dialog is shown. | |
692 if (handled) | |
693 last_user_gesture_time_ = base::TimeTicks(); | |
694 return handled; | |
685 } | 695 } |
686 | 696 |
687 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { | 697 void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { |
688 // Make sure we have the load state monitor running | 698 // Make sure we have the load state monitor running |
689 if (!update_load_states_timer_->IsRunning()) { | 699 if (!update_load_states_timer_->IsRunning()) { |
690 update_load_states_timer_->Start(FROM_HERE, | 700 update_load_states_timer_->Start(FROM_HERE, |
691 TimeDelta::FromMilliseconds(kUpdateLoadStatesIntervalMsec), | 701 TimeDelta::FromMilliseconds(kUpdateLoadStatesIntervalMsec), |
692 this, &ResourceDispatcherHostImpl::UpdateLoadStates); | 702 this, &ResourceDispatcherHostImpl::UpdateLoadStates); |
693 } | 703 } |
694 } | 704 } |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2028 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 2038 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
2029 && !policy->CanReadRawCookies(child_id)) { | 2039 && !policy->CanReadRawCookies(child_id)) { |
2030 VLOG(1) << "Denied unauthorized request for raw headers"; | 2040 VLOG(1) << "Denied unauthorized request for raw headers"; |
2031 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 2041 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
2032 } | 2042 } |
2033 | 2043 |
2034 return load_flags; | 2044 return load_flags; |
2035 } | 2045 } |
2036 | 2046 |
2037 } // namespace content | 2047 } // namespace content |
OLD | NEW |