| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ | 5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ |
| 6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ | 6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 SB_REASON_PHISHING, | 25 SB_REASON_PHISHING, |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 struct SBErrorDisplayOptions { | 28 struct SBErrorDisplayOptions { |
| 29 SBErrorDisplayOptions(bool is_main_frame_load_blocked, | 29 SBErrorDisplayOptions(bool is_main_frame_load_blocked, |
| 30 bool is_extended_reporting_opt_in_allowed, | 30 bool is_extended_reporting_opt_in_allowed, |
| 31 bool is_off_the_record, | 31 bool is_off_the_record, |
| 32 bool is_extended_reporting_enabled, | 32 bool is_extended_reporting_enabled, |
| 33 bool is_scout_reporting_enabled, | 33 bool is_scout_reporting_enabled, |
| 34 bool is_proceed_anyway_disabled, | 34 bool is_proceed_anyway_disabled, |
| 35 bool is_resource_cancellable) | 35 bool is_resource_cancellable, |
| 36 : is_main_frame_load_blocked(is_main_frame_load_blocked), | 36 const std::string& help_center_article_link); |
| 37 is_extended_reporting_opt_in_allowed( | 37 |
| 38 is_extended_reporting_opt_in_allowed), | 38 SBErrorDisplayOptions(const SBErrorDisplayOptions& other); |
| 39 is_off_the_record(is_off_the_record), | |
| 40 is_extended_reporting_enabled(is_extended_reporting_enabled), | |
| 41 is_scout_reporting_enabled(is_scout_reporting_enabled), | |
| 42 is_proceed_anyway_disabled(is_proceed_anyway_disabled), | |
| 43 is_resource_cancellable(is_resource_cancellable) {} | |
| 44 | 39 |
| 45 // Indicates if this SB interstitial is blocking main frame load. | 40 // Indicates if this SB interstitial is blocking main frame load. |
| 46 bool is_main_frame_load_blocked; | 41 bool is_main_frame_load_blocked; |
| 47 | 42 |
| 48 // Indicates if user is allowed to opt-in extended reporting preference. | 43 // Indicates if user is allowed to opt-in extended reporting preference. |
| 49 bool is_extended_reporting_opt_in_allowed; | 44 bool is_extended_reporting_opt_in_allowed; |
| 50 | 45 |
| 51 // Indicates if user is in incognito mode. | 46 // Indicates if user is in incognito mode. |
| 52 bool is_off_the_record; | 47 bool is_off_the_record; |
| 53 | 48 |
| 54 // Indicates if user opted in for SB extended reporting. | 49 // Indicates if user opted in for SB extended reporting. |
| 55 bool is_extended_reporting_enabled; | 50 bool is_extended_reporting_enabled; |
| 56 | 51 |
| 57 // Indicates if user opted in for Scout extended reporting. | 52 // Indicates if user opted in for Scout extended reporting. |
| 58 bool is_scout_reporting_enabled; | 53 bool is_scout_reporting_enabled; |
| 59 | 54 |
| 60 // Indicates if kSafeBrowsingProceedAnywayDisabled preference is set. | 55 // Indicates if kSafeBrowsingProceedAnywayDisabled preference is set. |
| 61 bool is_proceed_anyway_disabled; | 56 bool is_proceed_anyway_disabled; |
| 62 | 57 |
| 63 // Indicates if "back to safety" should cancel the pending navigation or | 58 // Indicates if "back to safety" should cancel the pending navigation or |
| 64 // navigate back after it's committed. | 59 // navigate back after it's committed. |
| 65 bool is_resource_cancellable; | 60 bool is_resource_cancellable; |
| 61 |
| 62 // The p= query parameter used when visiting the Help Center. If this is |
| 63 // nullptr, then a default value will be used for the SafeBrowsing article. |
| 64 std::string help_center_article_link; |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 BaseSafeBrowsingErrorUI( | 67 BaseSafeBrowsingErrorUI( |
| 69 const GURL& request_url, | 68 const GURL& request_url, |
| 70 const GURL& main_frame_url, | 69 const GURL& main_frame_url, |
| 71 BaseSafeBrowsingErrorUI::SBInterstitialReason reason, | 70 BaseSafeBrowsingErrorUI::SBInterstitialReason reason, |
| 72 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options, | 71 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options, |
| 73 const std::string& app_locale, | 72 const std::string& app_locale, |
| 74 const base::Time& time_triggered, | 73 const base::Time& time_triggered, |
| 75 ControllerClient* controller); | 74 ControllerClient* controller); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 98 } | 97 } |
| 99 | 98 |
| 100 bool is_proceed_anyway_disabled() const { | 99 bool is_proceed_anyway_disabled() const { |
| 101 return display_options_.is_proceed_anyway_disabled; | 100 return display_options_.is_proceed_anyway_disabled; |
| 102 } | 101 } |
| 103 | 102 |
| 104 bool is_resource_cancellable() const { | 103 bool is_resource_cancellable() const { |
| 105 return display_options_.is_resource_cancellable; | 104 return display_options_.is_resource_cancellable; |
| 106 } | 105 } |
| 107 | 106 |
| 107 const std::string& get_help_center_article_link() const { |
| 108 return display_options_.help_center_article_link; |
| 109 } |
| 110 |
| 108 // Checks if we should even show the extended reporting option. We don't show | 111 // Checks if we should even show the extended reporting option. We don't show |
| 109 // it in incognito mode or if kSafeBrowsingExtendedReportingOptInAllowed | 112 // it in incognito mode or if kSafeBrowsingExtendedReportingOptInAllowed |
| 110 // preference is disabled. | 113 // preference is disabled. |
| 111 bool CanShowExtendedReportingOption() { | 114 bool CanShowExtendedReportingOption() { |
| 112 return !is_off_the_record() && is_extended_reporting_opt_in_allowed(); | 115 return !is_off_the_record() && is_extended_reporting_opt_in_allowed(); |
| 113 } | 116 } |
| 114 | 117 |
| 115 SBInterstitialReason interstitial_reason() const { | 118 SBInterstitialReason interstitial_reason() const { |
| 116 return interstitial_reason_; | 119 return interstitial_reason_; |
| 117 } | 120 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 const base::Time time_triggered_; | 139 const base::Time time_triggered_; |
| 137 | 140 |
| 138 ControllerClient* controller_; | 141 ControllerClient* controller_; |
| 139 | 142 |
| 140 DISALLOW_COPY_AND_ASSIGN(BaseSafeBrowsingErrorUI); | 143 DISALLOW_COPY_AND_ASSIGN(BaseSafeBrowsingErrorUI); |
| 141 }; | 144 }; |
| 142 | 145 |
| 143 } // security_interstitials | 146 } // security_interstitials |
| 144 | 147 |
| 145 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ | 148 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ |
| OLD | NEW |