OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ | |
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "content/public/browser/navigation_throttle.h" | |
11 #include "content/public/browser/resource_throttle.h" | |
12 | |
13 namespace net { | |
14 class URLRequest; | |
15 } | |
16 | |
17 namespace content { | |
18 | |
19 // This ResourceThrottle is used to convey throttling information to the UI | |
20 // thread during navigations. The UI thread can then use its NavigationThrottle | |
21 // mechanism to interact with the navigation. | |
22 class NavigationResourceThrottle : public ResourceThrottle { | |
23 public: | |
24 NavigationResourceThrottle(net::URLRequest* request); | |
25 ~NavigationResourceThrottle() override; | |
26 | |
27 // ResourceThrottle overrides: | |
28 void WillStartRequest(bool* defer) override; | |
29 void WillRedirectRequest(const net::RedirectInfo& redirect_info, | |
30 bool* defer) override; | |
31 const char* GetNameForLogging() const override; | |
32 | |
33 private: | |
34 void OnUIChecksPerformed(NavigationThrottle::ThrottleCheckResult result); | |
35 | |
36 net::URLRequest* request_; | |
37 base::WeakPtrFactory<NavigationResourceThrottle> weak_ptr_factory_; | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(NavigationResourceThrottle); | |
40 }; | |
41 | |
42 } // namespace content | |
43 | |
44 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_THROTTLE_H_ | |
OLD | NEW |