OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ | 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ |
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "content/public/browser/interstitial_page_delegate.h" | 13 #include "content/public/browser/interstitial_page_delegate.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class InterstitialPage; | 17 class InterstitialPage; |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 // Delegate for an interstitial page when a page is blocked in managed mode | 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 | 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. | 23 // blocked page, to decide later whether to manually allow it. |
24 class ManagedModeInterstitial : public content::InterstitialPageDelegate { | 24 class ManagedModeInterstitial : public content::InterstitialPageDelegate { |
25 public: | 25 public: |
26 virtual ~ManagedModeInterstitial(); | |
Bernhard Bauer
2014/04/25 11:10:18
The destructor doesn't need to be public either. N
Marc Treib
2014/04/25 12:02:19
Done. Good point!
| |
27 | |
28 static void Show(content::WebContents* web_contents, | |
29 const GURL& url, | |
30 const base::Callback<void(bool)>& callback); | |
31 | |
32 private: | |
26 ManagedModeInterstitial(content::WebContents* web_contents, | 33 ManagedModeInterstitial(content::WebContents* web_contents, |
27 const GURL& url, | 34 const GURL& url, |
28 const base::Callback<void(bool)>& callback); | 35 const base::Callback<void(bool)>& callback); |
29 virtual ~ManagedModeInterstitial(); | |
30 | 36 |
31 private: | 37 bool Init(); |
38 | |
32 // InterstitialPageDelegate implementation. | 39 // InterstitialPageDelegate implementation. |
33 virtual std::string GetHTMLContents() OVERRIDE; | 40 virtual std::string GetHTMLContents() OVERRIDE; |
34 virtual void CommandReceived(const std::string& command) OVERRIDE; | 41 virtual void CommandReceived(const std::string& command) OVERRIDE; |
35 virtual void OnProceed() OVERRIDE; | 42 virtual void OnProceed() OVERRIDE; |
36 virtual void OnDontProceed() OVERRIDE; | 43 virtual void OnDontProceed() OVERRIDE; |
37 | 44 |
38 // Returns whether the blocked URL is now allowed. Called initially before the | 45 // 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 | 46 // interstitial is shown (to catch race conditions), or when the URL filtering |
40 // prefs change. | 47 // prefs change. |
41 bool ShouldProceed(); | 48 bool ShouldProceed(); |
(...skipping 11 matching lines...) Expand all Loading... | |
53 // The UI language. Used for formatting the URL for display. | 60 // The UI language. Used for formatting the URL for display. |
54 std::string languages_; | 61 std::string languages_; |
55 GURL url_; | 62 GURL url_; |
56 | 63 |
57 base::Callback<void(bool)> callback_; | 64 base::Callback<void(bool)> callback_; |
58 | 65 |
59 DISALLOW_COPY_AND_ASSIGN(ManagedModeInterstitial); | 66 DISALLOW_COPY_AND_ASSIGN(ManagedModeInterstitial); |
60 }; | 67 }; |
61 | 68 |
62 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ | 69 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ |
OLD | NEW |