Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / managed_mode / managed_mode_interstitial.h
blob06027d6df424968e0c8374b4df343c10682dfeb1
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_
8 #include <string>
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"
14 #include "url/gurl.h"
16 namespace content {
17 class InterstitialPage;
18 class WebContents;
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 {
25 public:
26 ManagedModeInterstitial(content::WebContents* web_contents,
27 const GURL& url,
28 const base::Callback<void(bool)>& callback);
29 virtual ~ManagedModeInterstitial();
31 private:
32 // InterstitialPageDelegate implementation.
33 virtual std::string GetHTMLContents() OVERRIDE;
34 virtual void CommandReceived(const std::string& command) OVERRIDE;
35 virtual void OnProceed() OVERRIDE;
36 virtual void OnDontProceed() OVERRIDE;
38 // Returns whether the blocked URL is now allowed. Called initially before the
39 // interstitial is shown (to catch race conditions), or when the URL filtering
40 // prefs change.
41 bool ShouldProceed();
43 void OnFilteringPrefsChanged();
44 void DispatchContinueRequest(bool continue_request);
46 // Owns the interstitial, which owns us.
47 content::WebContents* web_contents_;
49 content::InterstitialPage* interstitial_page_; // Owns us.
51 PrefChangeRegistrar pref_change_registrar_;
53 // The UI language. Used for formatting the URL for display.
54 std::string languages_;
55 GURL url_;
57 base::Callback<void(bool)> callback_;
59 DISALLOW_COPY_AND_ASSIGN(ManagedModeInterstitial);
62 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_