OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 13 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
14 #include "chrome/browser/supervised_user/supervised_users.h" | 14 #include "chrome/browser/supervised_user/supervised_users.h" |
15 #include "components/supervised_user_error_page/supervised_user_error_page.h" | 15 #include "components/supervised_user_error_page/supervised_user_error_page.h" |
16 #include "content/public/browser/navigation_throttle.h" | 16 #include "content/public/browser/navigation_throttle.h" |
17 | 17 |
18 class SupervisedUserNavigationThrottle : public content::NavigationThrottle { | 18 class SupervisedUserNavigationThrottle : public content::NavigationThrottle { |
19 public: | 19 public: |
20 // Returns a new throttle for the given navigation, or nullptr if no | 20 // Returns a new throttle for the given navigation, or nullptr if no |
21 // throttling is required. | 21 // throttling is required. |
22 static std::unique_ptr<SupervisedUserNavigationThrottle> | 22 static std::unique_ptr<SupervisedUserNavigationThrottle> |
23 MaybeCreateThrottleFor(content::NavigationHandle* navigation_handle); | 23 MaybeCreateThrottleFor(content::NavigationHandle* navigation_handle); |
24 | 24 |
25 ~SupervisedUserNavigationThrottle() override; | 25 ~SupervisedUserNavigationThrottle() override; |
26 | 26 |
27 // content::NavigationThrottle implementation: | 27 // content::NavigationThrottle implementation: |
28 ThrottleCheckResult WillStartRequest() override; | 28 ThrottleCheckResult WillStartRequest() override; |
29 ThrottleCheckResult WillRedirectRequest() override; | 29 ThrottleCheckResult WillRedirectRequest() override; |
| 30 const char* GetNameForLogging() override; |
30 | 31 |
31 private: | 32 private: |
32 SupervisedUserNavigationThrottle( | 33 SupervisedUserNavigationThrottle( |
33 content::NavigationHandle* navigation_handle); | 34 content::NavigationHandle* navigation_handle); |
34 | 35 |
35 // Checks the current URL for the navigation. If called from | 36 // Checks the current URL for the navigation. If called from |
36 // WillRedirectRequest, checks the URL being redirected to, not the original | 37 // WillRedirectRequest, checks the URL being redirected to, not the original |
37 // URL. | 38 // URL. |
38 ThrottleCheckResult CheckURL(); | 39 ThrottleCheckResult CheckURL(); |
39 | 40 |
(...skipping 17 matching lines...) Expand all Loading... |
57 | 58 |
58 const SupervisedUserURLFilter* url_filter_; | 59 const SupervisedUserURLFilter* url_filter_; |
59 bool deferred_; | 60 bool deferred_; |
60 SupervisedUserURLFilter::FilteringBehavior behavior_; | 61 SupervisedUserURLFilter::FilteringBehavior behavior_; |
61 base::WeakPtrFactory<SupervisedUserNavigationThrottle> weak_ptr_factory_; | 62 base::WeakPtrFactory<SupervisedUserNavigationThrottle> weak_ptr_factory_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationThrottle); | 64 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationThrottle); |
64 }; | 65 }; |
65 | 66 |
66 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_ | 67 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_ |
OLD | NEW |