Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: content/browser/loader/navigation_resource_throttle.h

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Addressed all jam@ latest comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/public/browser/navigation_throttle.h" 11 #include "content/public/browser/navigation_throttle.h"
12 #include "content/public/browser/resource_throttle.h" 12 #include "content/public/browser/resource_throttle.h"
13 #include "content/public/common/request_context_type.h" 13 #include "content/public/common/request_context_type.h"
14 14
15 namespace blink {
16 enum class WebMixedContentContextType;
17 }
18
15 namespace net { 19 namespace net {
16 class URLRequest; 20 class URLRequest;
17 } 21 }
18 22
19 namespace content { 23 namespace content {
20 class ResourceDispatcherHostDelegate; 24 class ResourceDispatcherHostDelegate;
21 25
22 // This ResourceThrottle is used to convey throttling information to the UI 26 // This ResourceThrottle is used to convey throttling information to the UI
23 // thread during navigations. The UI thread can then use its NavigationThrottle 27 // thread during navigations. The UI thread can then use its NavigationThrottle
24 // mechanism to interact with the navigation. 28 // mechanism to interact with the navigation.
25 class NavigationResourceThrottle : public ResourceThrottle { 29 class NavigationResourceThrottle : public ResourceThrottle {
26 public: 30 public:
27 NavigationResourceThrottle( 31 NavigationResourceThrottle(
28 net::URLRequest* request, 32 net::URLRequest* request,
29 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate, 33 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate,
30 RequestContextType request_context_type); 34 RequestContextType request_context_type,
35 blink::WebMixedContentContextType mixed_content_context_type);
31 ~NavigationResourceThrottle() override; 36 ~NavigationResourceThrottle() override;
32 37
33 // ResourceThrottle overrides: 38 // ResourceThrottle overrides:
34 void WillStartRequest(bool* defer) override; 39 void WillStartRequest(bool* defer) override;
35 void WillRedirectRequest(const net::RedirectInfo& redirect_info, 40 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
36 bool* defer) override; 41 bool* defer) override;
37 void WillProcessResponse(bool* defer) override; 42 void WillProcessResponse(bool* defer) override;
38 const char* GetNameForLogging() const override; 43 const char* GetNameForLogging() const override;
39 44
40 // Used in unit tests to make UI checks pass when they would fail due to no 45 // Used in unit tests to make UI checks pass when they would fail due to no
41 // NavigationHandle being present in the RenderFrameHost. 46 // NavigationHandle being present in the RenderFrameHost.
42 CONTENT_EXPORT static void set_ui_checks_always_succeed_for_testing( 47 CONTENT_EXPORT static void set_ui_checks_always_succeed_for_testing(
43 bool ui_checks_always_succeed); 48 bool ui_checks_always_succeed);
44 49
45 // Used in unit tests to make all navigations transfer. 50 // Used in unit tests to make all navigations transfer.
46 CONTENT_EXPORT static void set_force_transfer_for_testing( 51 CONTENT_EXPORT static void set_force_transfer_for_testing(
47 bool force_transfer); 52 bool force_transfer);
48 53
49 private: 54 private:
50 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result); 55 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result);
51 56
52 // Used in transfer navigations. 57 // Used in transfer navigations.
53 void InitiateTransfer(); 58 void InitiateTransfer();
54 void OnTransferComplete(); 59 void OnTransferComplete();
55 60
56 net::URLRequest* request_; 61 net::URLRequest* request_;
57 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_; 62 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_;
58 RequestContextType request_context_type_; 63 RequestContextType request_context_type_;
64 blink::WebMixedContentContextType mixed_content_context_type_;
59 bool in_cross_site_transition_; 65 bool in_cross_site_transition_;
60 NavigationThrottle::ThrottleCheckResult on_transfer_done_result_; 66 NavigationThrottle::ThrottleCheckResult on_transfer_done_result_;
61 67
62 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_; 68 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_;
63 69
64 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle); 70 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle);
65 }; 71 };
66 72
67 } // namespace content 73 } // namespace content
68 74
69 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ 75 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698