1 // Copyright (c) 2012 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_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/prefs/pref_change_registrar.h"
13 #include "content/public/browser/interstitial_page_delegate.h"
17 class InterstitialPage;
21 // Delegate for an interstitial page when a page is blocked in managed mode
22 // because it is not on any whitelist. It lets an authorized user preview the
23 // blocked page, to decide later whether to manually allow it.
24 class ManagedModeInterstitial : public content::InterstitialPageDelegate {
26 static void Show(content::WebContents* web_contents,
28 const base::Callback<void(bool)>& callback);
31 ManagedModeInterstitial(content::WebContents* web_contents,
33 const base::Callback<void(bool)>& callback);
34 virtual ~ManagedModeInterstitial();
38 // InterstitialPageDelegate implementation.
39 virtual std::string GetHTMLContents() OVERRIDE;
40 virtual void CommandReceived(const std::string& command) OVERRIDE;
41 virtual void OnProceed() OVERRIDE;
42 virtual void OnDontProceed() OVERRIDE;
44 // Returns whether the blocked URL is now allowed. Called initially before the
45 // interstitial is shown (to catch race conditions), or when the URL filtering
49 void OnFilteringPrefsChanged();
50 void DispatchContinueRequest(bool continue_request);
52 // Owns the interstitial, which owns us.
53 content::WebContents* web_contents_;
55 content::InterstitialPage* interstitial_page_; // Owns us.
57 PrefChangeRegistrar pref_change_registrar_;
59 // The UI language. Used for formatting the URL for display.
60 std::string languages_;
63 base::Callback<void(bool)> callback_;
65 DISALLOW_COPY_AND_ASSIGN(ManagedModeInterstitial);
68 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_