OLD | NEW |
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/public/browser/navigation_throttle.h" | 10 #include "content/public/browser/navigation_throttle.h" |
11 #include "content/public/browser/resource_throttle.h" | 11 #include "content/public/browser/resource_throttle.h" |
12 #include "content/public/common/request_context_type.h" | 12 #include "content/public/common/request_context_type.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 class URLRequest; | 15 class URLRequest; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class CertStore; | |
20 class ResourceDispatcherHostDelegate; | 19 class ResourceDispatcherHostDelegate; |
21 | 20 |
22 // This ResourceThrottle is used to convey throttling information to the UI | 21 // This ResourceThrottle is used to convey throttling information to the UI |
23 // thread during navigations. The UI thread can then use its NavigationThrottle | 22 // thread during navigations. The UI thread can then use its NavigationThrottle |
24 // mechanism to interact with the navigation. | 23 // mechanism to interact with the navigation. |
25 class NavigationResourceThrottle : public ResourceThrottle { | 24 class NavigationResourceThrottle : public ResourceThrottle { |
26 public: | 25 public: |
27 NavigationResourceThrottle( | 26 NavigationResourceThrottle( |
28 net::URLRequest* request, | 27 net::URLRequest* request, |
29 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate, | 28 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate, |
30 CertStore* cert_store, | |
31 RequestContextType request_context_type); | 29 RequestContextType request_context_type); |
32 ~NavigationResourceThrottle() override; | 30 ~NavigationResourceThrottle() override; |
33 | 31 |
34 // ResourceThrottle overrides: | 32 // ResourceThrottle overrides: |
35 void WillStartRequest(bool* defer) override; | 33 void WillStartRequest(bool* defer) override; |
36 void WillRedirectRequest(const net::RedirectInfo& redirect_info, | 34 void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
37 bool* defer) override; | 35 bool* defer) override; |
38 void WillProcessResponse(bool* defer) override; | 36 void WillProcessResponse(bool* defer) override; |
39 const char* GetNameForLogging() const override; | 37 const char* GetNameForLogging() const override; |
40 | 38 |
41 private: | 39 private: |
42 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result); | 40 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result); |
43 | 41 |
44 net::URLRequest* request_; | 42 net::URLRequest* request_; |
45 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_; | 43 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate_; |
46 CertStore* cert_store_; | |
47 RequestContextType request_context_type_; | 44 RequestContextType request_context_type_; |
48 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_; | 45 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_; |
49 | 46 |
50 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle); | 47 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle); |
51 }; | 48 }; |
52 | 49 |
53 } // namespace content | 50 } // namespace content |
54 | 51 |
55 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ | 52 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ |
OLD | NEW |