Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_resource_throttle.h
blob2c81a8c05abe013f05a4fd584e808db73f1aa2fa
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.
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
11 #include "chrome/browser/supervised_user/supervised_users.h"
12 #include "content/public/browser/resource_throttle.h"
14 namespace net {
15 class URLRequest;
18 class SupervisedUserResourceThrottle : public content::ResourceThrottle {
19 public:
20 SupervisedUserResourceThrottle(const net::URLRequest* request,
21 bool is_main_frame,
22 const SupervisedUserURLFilter* url_filter);
23 ~SupervisedUserResourceThrottle() override;
25 // content::ResourceThrottle implementation:
26 void WillStartRequest(bool* defer) override;
28 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
29 bool* defer) override;
31 const char* GetNameForLogging() const override;
33 private:
34 void ShowInterstitialIfNeeded(bool is_redirect, const GURL& url, bool* defer);
35 void ShowInterstitial(
36 const GURL& url,
37 SupervisedUserURLFilter::FilteringBehaviorReason reason);
38 void OnCheckDone(const GURL& url,
39 SupervisedUserURLFilter::FilteringBehavior behavior,
40 SupervisedUserURLFilter::FilteringBehaviorReason reason,
41 bool uncertain);
42 void OnInterstitialResult(bool continue_request);
44 const net::URLRequest* request_;
45 bool is_main_frame_;
46 const SupervisedUserURLFilter* url_filter_;
47 bool deferred_;
48 SupervisedUserURLFilter::FilteringBehavior behavior_;
49 base::WeakPtrFactory<SupervisedUserResourceThrottle> weak_ptr_factory_;
51 DISALLOW_COPY_AND_ASSIGN(SupervisedUserResourceThrottle);
54 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_RESOURCE_THROTTLE_H_