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