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

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

Issue 2321543002: Merge CrossSiteResourceHandler and NavigationResourceThrottle (Closed)
Patch Set: Rebase Created 4 years, 3 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/public/browser/navigation_throttle.h" 11 #include "content/public/browser/navigation_throttle.h"
11 #include "content/public/browser/resource_throttle.h" 12 #include "content/public/browser/resource_throttle.h"
12 #include "content/public/common/request_context_type.h" 13 #include "content/public/common/request_context_type.h"
13 14
14 namespace net { 15 namespace net {
15 class URLRequest; 16 class URLRequest;
16 } 17 }
17 18
18 namespace content { 19 namespace content {
19 class ResourceDispatcherHostDelegate; 20 class ResourceDispatcherHostDelegate;
20 21
21 // This ResourceThrottle is used to convey throttling information to the UI 22 // This ResourceThrottle is used to convey throttling information to the UI
22 // thread during navigations. The UI thread can then use its NavigationThrottle 23 // thread during navigations. The UI thread can then use its NavigationThrottle
23 // mechanism to interact with the navigation. 24 // mechanism to interact with the navigation.
24 class NavigationResourceThrottle : public ResourceThrottle { 25 class NavigationResourceThrottle : public ResourceThrottle {
25 public: 26 public:
26 NavigationResourceThrottle( 27 NavigationResourceThrottle(
27 net::URLRequest* request, 28 net::URLRequest* request,
28 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate, 29 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate,
29 RequestContextType request_context_type); 30 RequestContextType request_context_type);
30 ~NavigationResourceThrottle() override; 31 ~NavigationResourceThrottle() override;
31 32
32 // ResourceThrottle overrides: 33 // ResourceThrottle overrides:
33 void WillStartRequest(bool* defer) override; 34 void WillStartRequest(bool* defer) override;
34 void WillRedirectRequest(const net::RedirectInfo& redirect_info, 35 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
35 bool* defer) override; 36 bool* defer) override;
36 void WillProcessResponse(bool* defer) override; 37 void WillProcessResponse(bool* defer) override;
37 const char* GetNameForLogging() const override; 38 const char* GetNameForLogging() const override;
38 39
40 // Used in unit tests to make UI checks pass when they would fail due to no
41 // NavigationHandle being present in the RenderFrameHost.
42 CONTENT_EXPORT static void SetUIChecksAlwaysSuccedForTesting(
Charlie Reis 2016/09/16 21:19:26 Succed -> Succeed
clamy 2016/09/20 15:57:22 Done.
43 bool ui_checks_always_succeed);
44
45 // Used in unit tests to make all navigations transfer.
46 CONTENT_EXPORT static void SetForceTransferForTesting(
47 bool force_transfer);
48
39 private: 49 private:
40 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result); 50 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result);
41 51
52 // Used in transfer navigations.
53 void InitiateTransfer();
54 void OnTransferComplete();
55
42 net::URLRequest* request_; 56 net::URLRequest* request_;
43 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_; 57 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_;
44 RequestContextType request_context_type_; 58 RequestContextType request_context_type_;
59 bool in_cross_site_transition_;
60 NavigationThrottle::ThrottleCheckResult on_transfer_done_result_;
61
45 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_; 62 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_;
46 63
47 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle); 64 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle);
48 }; 65 };
49 66
50 } // namespace content 67 } // namespace content
51 68
52 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ 69 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698