| 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 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 class Profile; | 24 class Profile; |
| 25 | 25 |
| 26 // Delegate for an interstitial page when a page is blocked for a supervised | 26 // Delegate for an interstitial page when a page is blocked for a supervised |
| 27 // user because it is on a blacklist (in "allow everything" mode) or not on any | 27 // user because it is on a blacklist (in "allow everything" mode) or not on any |
| 28 // whitelist (in "allow only specified sites" mode). | 28 // whitelist (in "allow only specified sites" mode). |
| 29 class SupervisedUserInterstitial : public content::InterstitialPageDelegate, | 29 class SupervisedUserInterstitial : public content::InterstitialPageDelegate, |
| 30 public SupervisedUserServiceObserver { | 30 public SupervisedUserServiceObserver { |
| 31 public: | 31 public: |
| 32 ~SupervisedUserInterstitial() override; |
| 33 |
| 32 // Interstitial type, used for testing. | 34 // Interstitial type, used for testing. |
| 33 static content::InterstitialPageDelegate::TypeID kTypeForTesting; | 35 static content::InterstitialPageDelegate::TypeID kTypeForTesting; |
| 34 | 36 |
| 35 static void Show(content::WebContents* web_contents, | 37 static void Show(content::WebContents* web_contents, |
| 36 const GURL& url, | 38 const GURL& url, |
| 37 supervised_user_error_page::FilteringBehaviorReason reason, | 39 supervised_user_error_page::FilteringBehaviorReason reason, |
| 38 bool initial_page_load, | 40 bool initial_page_load, |
| 39 const base::Callback<void(bool)>& callback); | 41 const base::Callback<void(bool)>& callback); |
| 40 | 42 |
| 41 static std::string GetHTMLContents( | 43 static std::string GetHTMLContents( |
| 42 Profile* profile, | 44 Profile* profile, |
| 43 supervised_user_error_page::FilteringBehaviorReason reason); | 45 supervised_user_error_page::FilteringBehaviorReason reason); |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 SupervisedUserInterstitial( | 48 SupervisedUserInterstitial( |
| 47 content::WebContents* web_contents, | 49 content::WebContents* web_contents, |
| 48 const GURL& url, | 50 const GURL& url, |
| 49 supervised_user_error_page::FilteringBehaviorReason reason, | 51 supervised_user_error_page::FilteringBehaviorReason reason, |
| 50 bool initial_page_load, | 52 bool initial_page_load, |
| 51 const base::Callback<void(bool)>& callback); | 53 const base::Callback<void(bool)>& callback); |
| 52 ~SupervisedUserInterstitial() override; | |
| 53 | 54 |
| 54 bool Init(); | 55 bool Init(); |
| 55 | 56 |
| 56 // InterstitialPageDelegate implementation. | 57 // InterstitialPageDelegate implementation. |
| 57 std::string GetHTMLContents() override; | 58 std::string GetHTMLContents() override; |
| 58 void CommandReceived(const std::string& command) override; | 59 void CommandReceived(const std::string& command) override; |
| 59 void OnProceed() override; | 60 void OnProceed() override; |
| 60 void OnDontProceed() override; | 61 void OnDontProceed() override; |
| 61 content::InterstitialPageDelegate::TypeID GetTypeForTesting() const override; | 62 content::InterstitialPageDelegate::TypeID GetTypeForTesting() const override; |
| 62 | 63 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 bool initial_page_load_; | 96 bool initial_page_load_; |
| 96 | 97 |
| 97 base::Callback<void(bool)> callback_; | 98 base::Callback<void(bool)> callback_; |
| 98 | 99 |
| 99 base::WeakPtrFactory<SupervisedUserInterstitial> weak_ptr_factory_; | 100 base::WeakPtrFactory<SupervisedUserInterstitial> weak_ptr_factory_; |
| 100 | 101 |
| 101 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInterstitial); | 102 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInterstitial); |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ | 105 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_INTERSTITIAL_H_ |
| OLD | NEW |