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 { |
(...skipping 14 matching lines...) Expand all Loading... |
25 // If the NavigationHandle is destroyed while the navigation is deferred, | 25 // If the NavigationHandle is destroyed while the navigation is deferred, |
26 // the navigation will be canceled in the network stack. | 26 // the navigation will be canceled in the network stack. |
27 DEFER, | 27 DEFER, |
28 | 28 |
29 // Cancels the navigation. | 29 // Cancels the navigation. |
30 CANCEL, | 30 CANCEL, |
31 | 31 |
32 // Cancels the navigation and makes the requester of the navigation acts | 32 // Cancels the navigation and makes the requester of the navigation acts |
33 // like the request was never made. | 33 // like the request was never made. |
34 CANCEL_AND_IGNORE, | 34 CANCEL_AND_IGNORE, |
| 35 |
| 36 // Blocks a navigation due to rules asserted by a response (for instance, |
| 37 // embedding restrictions like 'X-Frame-Options'). This result will only |
| 38 // be returned from WillProcessResponse. |
| 39 BLOCK_RESPONSE, |
35 }; | 40 }; |
36 | 41 |
37 NavigationThrottle(NavigationHandle* navigation_handle); | 42 NavigationThrottle(NavigationHandle* navigation_handle); |
38 virtual ~NavigationThrottle(); | 43 virtual ~NavigationThrottle(); |
39 | 44 |
40 // Called when a network request is about to be made for this navigation. | 45 // Called when a network request is about to be made for this navigation. |
41 // | 46 // |
42 // The implementer is responsible for ensuring that the WebContents this | 47 // The implementer is responsible for ensuring that the WebContents this |
43 // throttle is associated with remain alive during the duration of this | 48 // throttle is associated with remain alive during the duration of this |
44 // method. Failing to do so will result in use-after-free bugs. Should the | 49 // method. Failing to do so will result in use-after-free bugs. Should the |
45 // implementer need to destroy the WebContents, it should return CANCEL, | 50 // implementer need to destroy the WebContents, it should return CANCEL, |
46 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. | 51 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. |
47 virtual ThrottleCheckResult WillStartRequest(); | 52 virtual ThrottleCheckResult WillStartRequest(); |
48 | 53 |
49 // Called when a server redirect is received by the navigation. | 54 // Called when a server redirect is received by the navigation. |
50 // | 55 // |
51 // The implementer is responsible for ensuring that the WebContents this | 56 // The implementer is responsible for ensuring that the WebContents this |
52 // throttle is associated with remain alive during the duration of this | 57 // throttle is associated with remain alive during the duration of this |
53 // method. Failing to do so will result in use-after-free bugs. Should the | 58 // method. Failing to do so will result in use-after-free bugs. Should the |
54 // implementer need to destroy the WebContents, it should return CANCEL, | 59 // implementer need to destroy the WebContents, it should return CANCEL, |
55 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. | 60 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. |
56 virtual ThrottleCheckResult WillRedirectRequest(); | 61 virtual ThrottleCheckResult WillRedirectRequest(); |
57 | 62 |
58 // Called when a response's headers and metadata are available. | 63 // Called when a response's headers and metadata are available. |
59 // | 64 // |
60 // The implementer is responsible for ensuring that the WebContents this | 65 // The implementer is responsible for ensuring that the WebContents this |
61 // throttle is associated with remain alive during the duration of this | 66 // throttle is associated with remain alive during the duration of this |
62 // method. Failing to do so will result in use-after-free bugs. Should the | 67 // method. Failing to do so will result in use-after-free bugs. Should the |
63 // implementer need to destroy the WebContents, it should return CANCEL, | 68 // implementer need to destroy the WebContents, it should return CANCEL, |
64 // CANCEL_AND_IGNORE and perform the destruction asynchronously. | 69 // CANCEL_AND_IGNORE, or BLOCK_RESPONSE and perform the destruction |
| 70 // asynchronously. |
65 virtual ThrottleCheckResult WillProcessResponse(); | 71 virtual ThrottleCheckResult WillProcessResponse(); |
66 | 72 |
67 // The NavigationHandle that is tracking the information related to this | 73 // The NavigationHandle that is tracking the information related to this |
68 // navigation. | 74 // navigation. |
69 NavigationHandle* navigation_handle() const { return navigation_handle_; } | 75 NavigationHandle* navigation_handle() const { return navigation_handle_; } |
70 | 76 |
71 private: | 77 private: |
72 NavigationHandle* navigation_handle_; | 78 NavigationHandle* navigation_handle_; |
73 }; | 79 }; |
74 | 80 |
75 } // namespace content | 81 } // namespace content |
76 | 82 |
77 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ | 83 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ |
OLD | NEW |