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_RESOURCE_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 11 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
12 #include "chrome/browser/supervised_user/supervised_users.h" | 12 #include "chrome/browser/supervised_user/supervised_users.h" |
| 13 #include "components/supervised_user_error_page/supervised_user_error_page.h" |
13 #include "content/public/browser/resource_throttle.h" | 14 #include "content/public/browser/resource_throttle.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 class URLRequest; | 17 class URLRequest; |
17 } | 18 } |
18 | 19 |
19 class SupervisedUserResourceThrottle : public content::ResourceThrottle { | 20 class SupervisedUserResourceThrottle : public content::ResourceThrottle { |
20 public: | 21 public: |
21 SupervisedUserResourceThrottle(const net::URLRequest* request, | 22 SupervisedUserResourceThrottle(const net::URLRequest* request, |
22 bool is_main_frame, | 23 bool is_main_frame, |
23 const SupervisedUserURLFilter* url_filter); | 24 const SupervisedUserURLFilter* url_filter); |
24 ~SupervisedUserResourceThrottle() override; | 25 ~SupervisedUserResourceThrottle() override; |
25 | 26 |
26 // content::ResourceThrottle implementation: | 27 // content::ResourceThrottle implementation: |
27 void WillStartRequest(bool* defer) override; | 28 void WillStartRequest(bool* defer) override; |
28 | 29 |
29 void WillRedirectRequest(const net::RedirectInfo& redirect_info, | 30 void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
30 bool* defer) override; | 31 bool* defer) override; |
31 | 32 |
32 const char* GetNameForLogging() const override; | 33 const char* GetNameForLogging() const override; |
33 | 34 |
34 private: | 35 private: |
35 void ShowInterstitialIfNeeded(bool is_redirect, const GURL& url, bool* defer); | 36 void ShowInterstitialIfNeeded(bool is_redirect, const GURL& url, bool* defer); |
36 void ShowInterstitial( | 37 void ShowInterstitial( |
37 const GURL& url, | 38 const GURL& url, |
38 SupervisedUserURLFilter::FilteringBehaviorReason reason); | 39 supervised_user_error_page::FilteringBehaviorReason reason); |
39 void OnCheckDone(const GURL& url, | 40 void OnCheckDone(const GURL& url, |
40 SupervisedUserURLFilter::FilteringBehavior behavior, | 41 SupervisedUserURLFilter::FilteringBehavior behavior, |
41 SupervisedUserURLFilter::FilteringBehaviorReason reason, | 42 supervised_user_error_page::FilteringBehaviorReason reason, |
42 bool uncertain); | 43 bool uncertain); |
43 void OnInterstitialResult(bool continue_request); | 44 void OnInterstitialResult(bool continue_request); |
44 | 45 |
45 const net::URLRequest* request_; | 46 const net::URLRequest* request_; |
46 bool is_main_frame_; | 47 bool is_main_frame_; |
47 const SupervisedUserURLFilter* url_filter_; | 48 const SupervisedUserURLFilter* url_filter_; |
48 bool deferred_; | 49 bool deferred_; |
49 SupervisedUserURLFilter::FilteringBehavior behavior_; | 50 SupervisedUserURLFilter::FilteringBehavior behavior_; |
50 base::WeakPtrFactory<SupervisedUserResourceThrottle> weak_ptr_factory_; | 51 base::WeakPtrFactory<SupervisedUserResourceThrottle> weak_ptr_factory_; |
51 | 52 |
52 DISALLOW_COPY_AND_ASSIGN(SupervisedUserResourceThrottle); | 53 DISALLOW_COPY_AND_ASSIGN(SupervisedUserResourceThrottle); |
53 }; | 54 }; |
54 | 55 |
55 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_ | 56 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_ |
OLD | NEW |