OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 public SupervisedUserServiceObserver { | 27 public SupervisedUserServiceObserver { |
28 public: | 28 public: |
29 static void Show(content::WebContents* web_contents, | 29 static void Show(content::WebContents* web_contents, |
30 const GURL& url, | 30 const GURL& url, |
31 const base::Callback<void(bool)>& callback); | 31 const base::Callback<void(bool)>& callback); |
32 | 32 |
33 private: | 33 private: |
34 SupervisedUserInterstitial(content::WebContents* web_contents, | 34 SupervisedUserInterstitial(content::WebContents* web_contents, |
35 const GURL& url, | 35 const GURL& url, |
36 const base::Callback<void(bool)>& callback); | 36 const base::Callback<void(bool)>& callback); |
37 virtual ~SupervisedUserInterstitial(); | 37 ~SupervisedUserInterstitial() override; |
38 | 38 |
39 bool Init(); | 39 bool Init(); |
40 | 40 |
41 // InterstitialPageDelegate implementation. | 41 // InterstitialPageDelegate implementation. |
42 virtual std::string GetHTMLContents() override; | 42 std::string GetHTMLContents() override; |
43 virtual void CommandReceived(const std::string& command) override; | 43 void CommandReceived(const std::string& command) override; |
44 virtual void OnProceed() override; | 44 void OnProceed() override; |
45 virtual void OnDontProceed() override; | 45 void OnDontProceed() override; |
46 | 46 |
47 // SupervisedUserServiceObserver implementation. | 47 // SupervisedUserServiceObserver implementation. |
48 virtual void OnURLFilterChanged() override; | 48 void OnURLFilterChanged() override; |
49 // TODO(treib): Also listen to OnCustodianInfoChanged and update as required. | 49 // TODO(treib): Also listen to OnCustodianInfoChanged and update as required. |
50 | 50 |
51 void OnAccessRequestAdded(bool success); | 51 void OnAccessRequestAdded(bool success); |
52 | 52 |
53 // Returns whether the blocked URL is now allowed. Called initially before the | 53 // Returns whether the blocked URL is now allowed. Called initially before the |
54 // interstitial is shown (to catch race conditions), or when the URL filtering | 54 // interstitial is shown (to catch race conditions), or when the URL filtering |
55 // prefs change. | 55 // prefs change. |
56 bool ShouldProceed(); | 56 bool ShouldProceed(); |
57 | 57 |
58 void DispatchContinueRequest(bool continue_request); | 58 void DispatchContinueRequest(bool continue_request); |
59 | 59 |
60 // Owns the interstitial, which owns us. | 60 // Owns the interstitial, which owns us. |
61 content::WebContents* web_contents_; | 61 content::WebContents* web_contents_; |
62 | 62 |
63 Profile* profile_; | 63 Profile* profile_; |
64 | 64 |
65 content::InterstitialPage* interstitial_page_; // Owns us. | 65 content::InterstitialPage* interstitial_page_; // Owns us. |
66 | 66 |
67 GURL url_; | 67 GURL url_; |
68 | 68 |
69 base::Callback<void(bool)> callback_; | 69 base::Callback<void(bool)> callback_; |
70 | 70 |
71 base::WeakPtrFactory<SupervisedUserInterstitial> weak_ptr_factory_; | 71 base::WeakPtrFactory<SupervisedUserInterstitial> weak_ptr_factory_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInterstitial); | 73 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInterstitial); |
74 }; | 74 }; |
75 | 75 |
76 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ | 76 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ |
OLD | NEW |