Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_interstitial.h
blob29f3d7226c6d7eb377fbf00ac10d8c872ee79d87
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_INTERSTITIAL_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/prefs/pref_change_registrar.h"
12 #include "content/public/browser/interstitial_page_delegate.h"
13 #include "url/gurl.h"
15 namespace content {
16 class InterstitialPage;
17 class WebContents;
20 // Delegate for an interstitial page when a page is blocked for a supervised
21 // user because it is on a blacklist (in "allow everything" mode) or not on any
22 // whitelist (in "allow only specified sites" mode).
23 class SupervisedUserInterstitial : public content::InterstitialPageDelegate {
24 public:
25 static void Show(content::WebContents* web_contents,
26 const GURL& url,
27 const base::Callback<void(bool)>& callback);
29 private:
30 SupervisedUserInterstitial(content::WebContents* web_contents,
31 const GURL& url,
32 const base::Callback<void(bool)>& callback);
33 virtual ~SupervisedUserInterstitial();
35 bool Init();
37 // InterstitialPageDelegate implementation.
38 virtual std::string GetHTMLContents() OVERRIDE;
39 virtual void CommandReceived(const std::string& command) OVERRIDE;
40 virtual void OnProceed() OVERRIDE;
41 virtual void OnDontProceed() OVERRIDE;
43 // Returns whether the blocked URL is now allowed. Called initially before the
44 // interstitial is shown (to catch race conditions), or when the URL filtering
45 // prefs change.
46 bool ShouldProceed();
48 void OnFilteringPrefsChanged();
49 void DispatchContinueRequest(bool continue_request);
51 // Owns the interstitial, which owns us.
52 content::WebContents* web_contents_;
54 content::InterstitialPage* interstitial_page_; // Owns us.
56 PrefChangeRegistrar pref_change_registrar_;
58 GURL url_;
60 base::Callback<void(bool)> callback_;
62 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInterstitial);
65 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_