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 const char* plink) | |
Jialiu Lin
2017/05/17 15:47:46
nit: prefer const std::string& over const char*
Nate Fischer
2017/05/17 22:34:43
Done
| |
36 : is_main_frame_load_blocked(is_main_frame_load_blocked), | 37 : is_main_frame_load_blocked(is_main_frame_load_blocked), |
37 is_extended_reporting_opt_in_allowed( | 38 is_extended_reporting_opt_in_allowed( |
38 is_extended_reporting_opt_in_allowed), | 39 is_extended_reporting_opt_in_allowed), |
39 is_off_the_record(is_off_the_record), | 40 is_off_the_record(is_off_the_record), |
40 is_extended_reporting_enabled(is_extended_reporting_enabled), | 41 is_extended_reporting_enabled(is_extended_reporting_enabled), |
41 is_scout_reporting_enabled(is_scout_reporting_enabled), | 42 is_scout_reporting_enabled(is_scout_reporting_enabled), |
42 is_proceed_anyway_disabled(is_proceed_anyway_disabled), | 43 is_proceed_anyway_disabled(is_proceed_anyway_disabled), |
43 is_resource_cancellable(is_resource_cancellable) {} | 44 is_resource_cancellable(is_resource_cancellable), |
45 plink(plink) {} | |
44 | 46 |
45 // Indicates if this SB interstitial is blocking main frame load. | 47 // Indicates if this SB interstitial is blocking main frame load. |
46 bool is_main_frame_load_blocked; | 48 bool is_main_frame_load_blocked; |
47 | 49 |
48 // Indicates if user is allowed to opt-in extended reporting preference. | 50 // Indicates if user is allowed to opt-in extended reporting preference. |
49 bool is_extended_reporting_opt_in_allowed; | 51 bool is_extended_reporting_opt_in_allowed; |
50 | 52 |
51 // Indicates if user is in incognito mode. | 53 // Indicates if user is in incognito mode. |
52 bool is_off_the_record; | 54 bool is_off_the_record; |
53 | 55 |
54 // Indicates if user opted in for SB extended reporting. | 56 // Indicates if user opted in for SB extended reporting. |
55 bool is_extended_reporting_enabled; | 57 bool is_extended_reporting_enabled; |
56 | 58 |
57 // Indicates if user opted in for Scout extended reporting. | 59 // Indicates if user opted in for Scout extended reporting. |
58 bool is_scout_reporting_enabled; | 60 bool is_scout_reporting_enabled; |
59 | 61 |
60 // Indicates if kSafeBrowsingProceedAnywayDisabled preference is set. | 62 // Indicates if kSafeBrowsingProceedAnywayDisabled preference is set. |
61 bool is_proceed_anyway_disabled; | 63 bool is_proceed_anyway_disabled; |
62 | 64 |
63 // Indicates if "back to safety" should cancel the pending navigation or | 65 // Indicates if "back to safety" should cancel the pending navigation or |
64 // navigate back after it's committed. | 66 // navigate back after it's committed. |
65 bool is_resource_cancellable; | 67 bool is_resource_cancellable; |
68 | |
69 // The p= query parameter used when visiting the Help Center. If this is | |
70 // nullptr, then a default value will be used for the SafeBrowsing article. | |
71 const char* plink; | |
Jialiu Lin
2017/05/17 15:47:46
nit: plink is a very general name, unless you want
Nate Fischer
2017/05/17 22:34:43
Done
| |
66 }; | 72 }; |
67 | 73 |
68 BaseSafeBrowsingErrorUI( | 74 BaseSafeBrowsingErrorUI( |
69 const GURL& request_url, | 75 const GURL& request_url, |
70 const GURL& main_frame_url, | 76 const GURL& main_frame_url, |
71 BaseSafeBrowsingErrorUI::SBInterstitialReason reason, | 77 BaseSafeBrowsingErrorUI::SBInterstitialReason reason, |
72 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options, | 78 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options, |
73 const std::string& app_locale, | 79 const std::string& app_locale, |
74 const base::Time& time_triggered, | 80 const base::Time& time_triggered, |
75 ControllerClient* controller); | 81 ControllerClient* controller); |
(...skipping 22 matching lines...) Expand all Loading... | |
98 } | 104 } |
99 | 105 |
100 bool is_proceed_anyway_disabled() const { | 106 bool is_proceed_anyway_disabled() const { |
101 return display_options_.is_proceed_anyway_disabled; | 107 return display_options_.is_proceed_anyway_disabled; |
102 } | 108 } |
103 | 109 |
104 bool is_resource_cancellable() const { | 110 bool is_resource_cancellable() const { |
105 return display_options_.is_resource_cancellable; | 111 return display_options_.is_resource_cancellable; |
106 } | 112 } |
107 | 113 |
114 const char* get_plink() const { return display_options_.plink; } | |
115 | |
108 // Checks if we should even show the extended reporting option. We don't show | 116 // Checks if we should even show the extended reporting option. We don't show |
109 // it in incognito mode or if kSafeBrowsingExtendedReportingOptInAllowed | 117 // it in incognito mode or if kSafeBrowsingExtendedReportingOptInAllowed |
110 // preference is disabled. | 118 // preference is disabled. |
111 bool CanShowExtendedReportingOption() { | 119 bool CanShowExtendedReportingOption() { |
112 return !is_off_the_record() && is_extended_reporting_opt_in_allowed(); | 120 return !is_off_the_record() && is_extended_reporting_opt_in_allowed(); |
113 } | 121 } |
114 | 122 |
115 SBInterstitialReason interstitial_reason() const { | 123 SBInterstitialReason interstitial_reason() const { |
116 return interstitial_reason_; | 124 return interstitial_reason_; |
117 } | 125 } |
(...skipping 18 matching lines...) Expand all Loading... | |
136 const base::Time time_triggered_; | 144 const base::Time time_triggered_; |
137 | 145 |
138 ControllerClient* controller_; | 146 ControllerClient* controller_; |
139 | 147 |
140 DISALLOW_COPY_AND_ASSIGN(BaseSafeBrowsingErrorUI); | 148 DISALLOW_COPY_AND_ASSIGN(BaseSafeBrowsingErrorUI); |
141 }; | 149 }; |
142 | 150 |
143 } // security_interstitials | 151 } // security_interstitials |
144 | 152 |
145 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ | 153 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_BASE_SAFE_BROWSING_ERROR_UI_H_ |
OLD | NEW |