| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/frame_host/mixed_content_navigation_throttle.h" | 5 #include "content/browser/frame_host/mixed_content_navigation_throttle.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 ThrottleCheckResult MixedContentNavigationThrottle::WillProcessResponse() { | 143 ThrottleCheckResult MixedContentNavigationThrottle::WillProcessResponse() { |
| 144 // TODO(carlosk): At this point we are about to process the request response. | 144 // TODO(carlosk): At this point we are about to process the request response. |
| 145 // So if we ever need to, here/now it is a good moment to check for the final | 145 // So if we ever need to, here/now it is a good moment to check for the final |
| 146 // attained security level of the connection. For instance, does it use an | 146 // attained security level of the connection. For instance, does it use an |
| 147 // outdated protocol? The implementation should be based off | 147 // outdated protocol? The implementation should be based off |
| 148 // MixedContentChecker::handleCertificateError. See https://crbug.com/576270. | 148 // MixedContentChecker::handleCertificateError. See https://crbug.com/576270. |
| 149 return ThrottleCheckResult::PROCEED; | 149 return ThrottleCheckResult::PROCEED; |
| 150 } | 150 } |
| 151 | 151 |
| 152 const char* MixedContentNavigationThrottle::GetNameForLogging() { |
| 153 return "MixedContentNavigationThrottle"; |
| 154 } |
| 155 |
| 152 // Based off of MixedContentChecker::shouldBlockFetch. | 156 // Based off of MixedContentChecker::shouldBlockFetch. |
| 153 bool MixedContentNavigationThrottle::ShouldBlockNavigation(bool for_redirect) { | 157 bool MixedContentNavigationThrottle::ShouldBlockNavigation(bool for_redirect) { |
| 154 NavigationHandleImpl* handle_impl = | 158 NavigationHandleImpl* handle_impl = |
| 155 static_cast<NavigationHandleImpl*>(navigation_handle()); | 159 static_cast<NavigationHandleImpl*>(navigation_handle()); |
| 156 FrameTreeNode* node = handle_impl->frame_tree_node(); | 160 FrameTreeNode* node = handle_impl->frame_tree_node(); |
| 157 | 161 |
| 158 // Find the parent node where mixed content is characterized, if any. | 162 // Find the parent node where mixed content is characterized, if any. |
| 159 FrameTreeNode* mixed_content_node = | 163 FrameTreeNode* mixed_content_node = |
| 160 InWhichFrameIsContentMixed(node, handle_impl->GetURL()); | 164 InWhichFrameIsContentMixed(node, handle_impl->GetURL()); |
| 161 if (!mixed_content_node) { | 165 if (!mixed_content_node) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // static | 358 // static |
| 355 bool MixedContentNavigationThrottle::IsMixedContentForTesting( | 359 bool MixedContentNavigationThrottle::IsMixedContentForTesting( |
| 356 const GURL& origin_url, | 360 const GURL& origin_url, |
| 357 const GURL& url) { | 361 const GURL& url) { |
| 358 const url::Origin origin(origin_url); | 362 const url::Origin origin(origin_url); |
| 359 return !IsUrlPotentiallySecure(url) && | 363 return !IsUrlPotentiallySecure(url) && |
| 360 DoesOriginSchemeRestrictMixedContent(origin); | 364 DoesOriginSchemeRestrictMixedContent(origin); |
| 361 } | 365 } |
| 362 | 366 |
| 363 } // namespace content | 367 } // namespace content |
| OLD | NEW |