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_
10 #include "base/callback.h"
11 #include "base/prefs/pref_change_registrar.h"
12 #include "content/public/browser/interstitial_page_delegate.h"
16 class InterstitialPage
;
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
{
25 static void Show(content::WebContents
* web_contents
,
27 const base::Callback
<void(bool)>& callback
);
30 SupervisedUserInterstitial(content::WebContents
* web_contents
,
32 const base::Callback
<void(bool)>& callback
);
33 virtual ~SupervisedUserInterstitial();
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
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_
;
60 base::Callback
<void(bool)> callback_
;
62 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInterstitial
);
65 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_