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_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 class NavigationHandle; | 11 class NavigationHandle; |
12 | 12 |
13 // A NavigationThrottle tracks and allows interaction with a navigation on the | 13 // A NavigationThrottle tracks and allows interaction with a navigation on the |
14 // UI thread. | 14 // UI thread. |
15 class CONTENT_EXPORT NavigationThrottle { | 15 class CONTENT_EXPORT NavigationThrottle { |
16 public: | 16 public: |
17 // This is returned to the NavigationHandle to allow the navigation to | 17 // This is returned to the NavigationHandle to allow the navigation to |
18 // proceed, or to cancel it. | 18 // proceed, or to cancel it. |
19 enum ThrottleCheckResult { | 19 enum ThrottleCheckResult { |
| 20 // The navigation proceeds uninterrupted. |
20 PROCEED, | 21 PROCEED, |
| 22 |
| 23 // Defers the navigation until the NavigationThrottle calls |
| 24 // NavigationHandle::Resume or NavigationHandle::CancelDeferredRequest. |
21 DEFER, | 25 DEFER, |
| 26 |
| 27 // Cancels the navigation. |
| 28 CANCEL, |
| 29 |
| 30 // Cancels the navigation and makes the requester of the navigation acts |
| 31 // like the request was never made. |
22 CANCEL_AND_IGNORE, | 32 CANCEL_AND_IGNORE, |
23 }; | 33 }; |
24 | 34 |
25 NavigationThrottle(NavigationHandle* navigation_handle); | 35 NavigationThrottle(NavigationHandle* navigation_handle); |
26 virtual ~NavigationThrottle(); | 36 virtual ~NavigationThrottle(); |
27 | 37 |
28 // Called when a network request is about to be made for this navigation. | 38 // Called when a network request is about to be made for this navigation. |
29 virtual ThrottleCheckResult WillStartRequest(); | 39 virtual ThrottleCheckResult WillStartRequest(); |
30 | 40 |
31 // Called when a server redirect is received by the navigation. | 41 // Called when a server redirect is received by the navigation. |
32 virtual ThrottleCheckResult WillRedirectRequest(); | 42 virtual ThrottleCheckResult WillRedirectRequest(); |
33 | 43 |
34 // The NavigationHandle that is tracking the information related to this | 44 // The NavigationHandle that is tracking the information related to this |
35 // navigation. | 45 // navigation. |
36 NavigationHandle* navigation_handle() const { return navigation_handle_; } | 46 NavigationHandle* navigation_handle() const { return navigation_handle_; } |
37 | 47 |
38 private: | 48 private: |
39 NavigationHandle* navigation_handle_; | 49 NavigationHandle* navigation_handle_; |
40 }; | 50 }; |
41 | 51 |
42 } // namespace content | 52 } // namespace content |
43 | 53 |
44 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ | 54 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ |
OLD | NEW |