OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_navigation_throttle.h" | 5 #include "chrome/browser/chromeos/arc/arc_navigation_throttle.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // No picker has previously been popped up for this - continue. | 96 // No picker has previously been popped up for this - continue. |
97 break; | 97 break; |
98 } | 98 } |
99 return HandleRequest(); | 99 return HandleRequest(); |
100 } | 100 } |
101 | 101 |
102 content::NavigationThrottle::ThrottleCheckResult | 102 content::NavigationThrottle::ThrottleCheckResult |
103 ArcNavigationThrottle::HandleRequest() { | 103 ArcNavigationThrottle::HandleRequest() { |
104 const GURL& url = navigation_handle()->GetURL(); | 104 const GURL& url = navigation_handle()->GetURL(); |
105 | 105 |
106 if (ShouldIgnoreNavigation(navigation_handle()->GetPageTransition())) | 106 // Always handle http(s) <form> submissions in Chrome for two reasons: 1) we |
| 107 // don't have a way to send POST data to ARC, and 2) intercepting http(s) form |
| 108 // submissions is not very important because such submissions are usually |
| 109 // done within the same domain. ShouldOverrideUrlLoading() below filters out |
| 110 // such submissions anyway. |
| 111 constexpr bool kAllowFormSubmit = false; |
| 112 |
| 113 if (ShouldIgnoreNavigation(navigation_handle()->GetPageTransition(), |
| 114 kAllowFormSubmit)) |
107 return content::NavigationThrottle::PROCEED; | 115 return content::NavigationThrottle::PROCEED; |
108 | 116 |
109 const GURL previous_url = navigation_handle()->GetReferrer().url; | 117 const GURL previous_url = navigation_handle()->GetReferrer().url; |
110 const GURL current_url = navigation_handle()->GetURL(); | 118 const GURL current_url = navigation_handle()->GetURL(); |
111 if (!ShouldOverrideUrlLoading(previous_url, current_url)) | 119 if (!ShouldOverrideUrlLoading(previous_url, current_url)) |
112 return content::NavigationThrottle::PROCEED; | 120 return content::NavigationThrottle::PROCEED; |
113 | 121 |
114 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); | 122 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); |
115 DCHECK(arc_service_manager); | 123 DCHECK(arc_service_manager); |
116 scoped_refptr<arc::LocalActivityResolver> local_resolver = | 124 scoped_refptr<arc::LocalActivityResolver> local_resolver = |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 282 } |
275 | 283 |
276 // static | 284 // static |
277 bool ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | 285 bool ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( |
278 const GURL& previous_url, | 286 const GURL& previous_url, |
279 const GURL& current_url) { | 287 const GURL& current_url) { |
280 return ShouldOverrideUrlLoading(previous_url, current_url); | 288 return ShouldOverrideUrlLoading(previous_url, current_url); |
281 } | 289 } |
282 | 290 |
283 } // namespace arc | 291 } // namespace arc |
OLD | NEW |