Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: chrome/browser/supervised_user/supervised_user_navigation_throttle.h

Issue 2776493005: Convert SupervisedUserResourceThrottle to a NavigationThrottle. (Closed)
Patch Set: Response to comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_
7
8 #include <memory>
9
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
14 #include "chrome/browser/supervised_user/supervised_users.h"
15 #include "components/supervised_user_error_page/supervised_user_error_page.h"
16 #include "content/public/browser/navigation_throttle.h"
17
18 class SupervisedUserNavigationThrottle : public content::NavigationThrottle {
19 public:
20 // Returns a new throttle for the given navigation, or nullptr if no
21 // throttling is required.
22 static std::unique_ptr<SupervisedUserNavigationThrottle>
23 MaybeCreateThrottleFor(content::NavigationHandle* navigation_handle);
24
25 ~SupervisedUserNavigationThrottle() override;
26
27 // content::NavigationThrottle implementation:
28 ThrottleCheckResult WillStartRequest() override;
29 ThrottleCheckResult WillRedirectRequest() override;
30
31 private:
32 SupervisedUserNavigationThrottle(
33 content::NavigationHandle* navigation_handle);
34
35 // Checks the current URL for the navigation. If called from
36 // WillRedirectRequest, checks the URL being redirected to, not the original
37 // URL.
38 ThrottleCheckResult CheckURL();
39
40 void ShowInterstitial(
41 const GURL& url,
42 supervised_user_error_page::FilteringBehaviorReason reason);
43
44 void ShowInterstitialAsync(
45 supervised_user_error_page::FilteringBehaviorReason reason);
46
47 void OnCheckDone(const GURL& url,
48 SupervisedUserURLFilter::FilteringBehavior behavior,
49 supervised_user_error_page::FilteringBehaviorReason reason,
50 bool uncertain);
51
52 void OnInterstitialResult(bool continue_request);
53
54 void Resume();
55
56 void Cancel();
57
58 const SupervisedUserURLFilter* url_filter_;
59 bool deferred_;
60 SupervisedUserURLFilter::FilteringBehavior behavior_;
61 base::WeakPtrFactory<SupervisedUserNavigationThrottle> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(SupervisedUserNavigationThrottle);
64 };
65
66 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_NAVIGATION_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698