Chromium Code Reviews| 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 // Block the navigation. | |
| 37 BLOCK, | |
| 35 }; | 38 }; |
| 36 | 39 |
| 37 NavigationThrottle(NavigationHandle* navigation_handle); | 40 NavigationThrottle(NavigationHandle* navigation_handle); |
| 38 virtual ~NavigationThrottle(); | 41 virtual ~NavigationThrottle(); |
| 39 | 42 |
| 40 // Called when a network request is about to be made for this navigation. | 43 // Called when a network request is about to be made for this navigation. |
| 41 // | 44 // |
| 42 // The implementer is responsible for ensuring that the WebContents this | 45 // The implementer is responsible for ensuring that the WebContents this |
| 43 // throttle is associated with remain alive during the duration of this | 46 // 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 | 47 // 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, | 48 // implementer need to destroy the WebContents, it should return CANCEL, |
| 46 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. | 49 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. |
| 47 virtual ThrottleCheckResult WillStartRequest(); | 50 virtual ThrottleCheckResult WillStartRequest(); |
| 48 | 51 |
| 49 // Called when a server redirect is received by the navigation. | 52 // Called when a server redirect is received by the navigation. |
| 50 // | 53 // |
| 51 // The implementer is responsible for ensuring that the WebContents this | 54 // The implementer is responsible for ensuring that the WebContents this |
| 52 // throttle is associated with remain alive during the duration of this | 55 // 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 | 56 // 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, | 57 // implementer need to destroy the WebContents, it should return CANCEL, |
| 55 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. | 58 // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously. |
| 56 virtual ThrottleCheckResult WillRedirectRequest(); | 59 virtual ThrottleCheckResult WillRedirectRequest(); |
| 57 | 60 |
| 61 // Called when a network response is ready to commit for this navigation. | |
| 62 // | |
| 63 // The implementer is responsible for ensuring that the WebContents this | |
| 64 // throttle is associated with remain alive during the duration of this | |
| 65 // method. Failing to do so will result in use-after-free bugs. Should the | |
| 66 // implementer need to destroy the WebContents, it should return CANCEL or | |
| 67 // CANCEL_AND_IGNORE and perform the destruction asynchronously. This method | |
| 68 // must not return DEFER, as it is the last step before committing. | |
|
nasko
2016/01/20 23:15:07
Should we be adding BLOCK to the lists of possible
Mike West
2016/01/21 14:51:24
We should, and have. Thanks!
| |
| 69 virtual ThrottleCheckResult WillProcessResponse(); | |
| 70 | |
| 58 // The NavigationHandle that is tracking the information related to this | 71 // The NavigationHandle that is tracking the information related to this |
| 59 // navigation. | 72 // navigation. |
| 60 NavigationHandle* navigation_handle() const { return navigation_handle_; } | 73 NavigationHandle* navigation_handle() const { return navigation_handle_; } |
| 61 | 74 |
| 62 private: | 75 private: |
| 63 NavigationHandle* navigation_handle_; | 76 NavigationHandle* navigation_handle_; |
| 64 }; | 77 }; |
| 65 | 78 |
| 66 } // namespace content | 79 } // namespace content |
| 67 | 80 |
| 68 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ | 81 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_ |
| OLD | NEW |