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 COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ | 5 #ifndef COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ |
6 #define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ | 6 #define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 CheckCallback; | 30 CheckCallback; |
31 | 31 |
32 InterceptNavigationThrottle(content::NavigationHandle* navigation_handle, | 32 InterceptNavigationThrottle(content::NavigationHandle* navigation_handle, |
33 CheckCallback should_ignore_callback, | 33 CheckCallback should_ignore_callback, |
34 bool run_callback_synchronously); | 34 bool run_callback_synchronously); |
35 ~InterceptNavigationThrottle() override; | 35 ~InterceptNavigationThrottle() override; |
36 | 36 |
37 // content::NavigationThrottle implementation: | 37 // content::NavigationThrottle implementation: |
38 ThrottleCheckResult WillStartRequest() override; | 38 ThrottleCheckResult WillStartRequest() override; |
39 ThrottleCheckResult WillRedirectRequest() override; | 39 ThrottleCheckResult WillRedirectRequest() override; |
| 40 const char* GetNameForLogging() override; |
40 | 41 |
41 private: | 42 private: |
42 ThrottleCheckResult CheckIfShouldIgnoreNavigation(bool is_redirect); | 43 ThrottleCheckResult CheckIfShouldIgnoreNavigation(bool is_redirect); |
43 | 44 |
44 // Called to perform the checks asynchronously | 45 // Called to perform the checks asynchronously |
45 void RunCallbackAsynchronously(const NavigationParams& navigation_params); | 46 void RunCallbackAsynchronously(const NavigationParams& navigation_params); |
46 // TODO(clamy): remove |throttle_was_destroyed| once crbug.com/570200 is | 47 // TODO(clamy): remove |throttle_was_destroyed| once crbug.com/570200 is |
47 // fixed. | 48 // fixed. |
48 void OnAsynchronousChecksPerformed(bool should_ignore_navigation, | 49 void OnAsynchronousChecksPerformed(bool should_ignore_navigation, |
49 bool throttle_was_destroyed); | 50 bool throttle_was_destroyed); |
50 | 51 |
51 CheckCallback should_ignore_callback_; | 52 CheckCallback should_ignore_callback_; |
52 | 53 |
53 // Whether the callback will be run synchronously or not. If the callback can | 54 // Whether the callback will be run synchronously or not. If the callback can |
54 // lead to the destruction of the WebContents, this should be false. | 55 // lead to the destruction of the WebContents, this should be false. |
55 // Otherwise this should be true. | 56 // Otherwise this should be true. |
56 const bool run_callback_synchronously_; | 57 const bool run_callback_synchronously_; |
57 | 58 |
58 base::WeakPtrFactory<InterceptNavigationThrottle> weak_factory_; | 59 base::WeakPtrFactory<InterceptNavigationThrottle> weak_factory_; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationThrottle); | 61 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationThrottle); |
61 }; | 62 }; |
62 | 63 |
63 } // namespace navigation_interception | 64 } // namespace navigation_interception |
64 | 65 |
65 #endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ | 66 #endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ |
OLD | NEW |