| 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/form_submission_throttle.h" | 5 #include "content/browser/frame_host/form_submission_throttle.h" |
| 6 #include "content/browser/frame_host/navigation_handle_impl.h" | 6 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" |
| 9 #include "content/public/browser/navigation_throttle.h" | 9 #include "content/public/browser/navigation_throttle.h" |
| 10 #include "content/public/common/browser_side_navigation_policy.h" | 10 #include "content/public/common/browser_side_navigation_policy.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 NavigationThrottle::ThrottleCheckResult | 37 NavigationThrottle::ThrottleCheckResult |
| 38 FormSubmissionThrottle::WillStartRequest() { | 38 FormSubmissionThrottle::WillStartRequest() { |
| 39 return CheckContentSecurityPolicyFormAction(false /* is_redirect */); | 39 return CheckContentSecurityPolicyFormAction(false /* is_redirect */); |
| 40 } | 40 } |
| 41 | 41 |
| 42 NavigationThrottle::ThrottleCheckResult | 42 NavigationThrottle::ThrottleCheckResult |
| 43 FormSubmissionThrottle::WillRedirectRequest() { | 43 FormSubmissionThrottle::WillRedirectRequest() { |
| 44 return CheckContentSecurityPolicyFormAction(true /* is_redirect */); | 44 return CheckContentSecurityPolicyFormAction(true /* is_redirect */); |
| 45 } | 45 } |
| 46 | 46 |
| 47 const char* FormSubmissionThrottle::GetNameForLogging() { |
| 48 return "FormSubmissionThrottle"; |
| 49 } |
| 50 |
| 47 NavigationThrottle::ThrottleCheckResult | 51 NavigationThrottle::ThrottleCheckResult |
| 48 FormSubmissionThrottle::CheckContentSecurityPolicyFormAction(bool is_redirect) { | 52 FormSubmissionThrottle::CheckContentSecurityPolicyFormAction(bool is_redirect) { |
| 49 NavigationHandleImpl* handle = | 53 NavigationHandleImpl* handle = |
| 50 static_cast<NavigationHandleImpl*>(navigation_handle()); | 54 static_cast<NavigationHandleImpl*>(navigation_handle()); |
| 51 | 55 |
| 52 if (handle->should_check_main_world_csp() == CSPDisposition::DO_NOT_CHECK) | 56 if (handle->should_check_main_world_csp() == CSPDisposition::DO_NOT_CHECK) |
| 53 return NavigationThrottle::PROCEED; | 57 return NavigationThrottle::PROCEED; |
| 54 | 58 |
| 55 const GURL& url = handle->GetURL(); | 59 const GURL& url = handle->GetURL(); |
| 56 RenderFrameHostImpl* render_frame = | 60 RenderFrameHostImpl* render_frame = |
| 57 handle->frame_tree_node()->current_frame_host(); | 61 handle->frame_tree_node()->current_frame_host(); |
| 58 | 62 |
| 59 if (render_frame->IsAllowedByCsp(CSPDirective::FormAction, url, is_redirect, | 63 if (render_frame->IsAllowedByCsp(CSPDirective::FormAction, url, is_redirect, |
| 60 handle->source_location())) { | 64 handle->source_location())) { |
| 61 return NavigationThrottle::PROCEED; | 65 return NavigationThrottle::PROCEED; |
| 62 } | 66 } |
| 63 | 67 |
| 64 return NavigationThrottle::CANCEL; | 68 return NavigationThrottle::CANCEL; |
| 65 } | 69 } |
| 66 | 70 |
| 67 } // namespace content | 71 } // namespace content |
| OLD | NEW |