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 // Implementation of the SafeBrowsingBlockingPage class. | 5 // Implementation of the SafeBrowsingBlockingPage class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_piece.h" | 20 #include "base/strings/string_piece.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/interstitials/chrome_controller_client.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/renderer_preferences_util.h" | 28 #include "chrome/browser/renderer_preferences_util.h" |
28 #include "chrome/browser/safe_browsing/threat_details.h" | 29 #include "chrome/browser/safe_browsing/threat_details.h" |
29 #include "chrome/browser/safe_browsing/ui_manager.h" | 30 #include "chrome/browser/safe_browsing/ui_manager.h" |
30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
32 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
33 #include "chrome/grit/generated_resources.h" | 34 #include "chrome/grit/generated_resources.h" |
34 #include "components/google/core/browser/google_util.h" | 35 #include "components/google/core/browser/google_util.h" |
35 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 return; | 230 return; |
230 } | 231 } |
231 | 232 |
232 int command = 0; | 233 int command = 0; |
233 bool retval = base::StringToInt(page_cmd, &command); | 234 bool retval = base::StringToInt(page_cmd, &command); |
234 DCHECK(retval) << page_cmd; | 235 DCHECK(retval) << page_cmd; |
235 | 236 |
236 switch (command) { | 237 switch (command) { |
237 case security_interstitials::CMD_DO_REPORT: { | 238 case security_interstitials::CMD_DO_REPORT: { |
238 // User enabled SB Extended Reporting via the checkbox. | 239 // User enabled SB Extended Reporting via the checkbox. |
239 SetReportingPreference(true); | 240 controller()->SetReportingPreference(true); |
240 break; | 241 break; |
241 } | 242 } |
242 case security_interstitials::CMD_DONT_REPORT: { | 243 case security_interstitials::CMD_DONT_REPORT: { |
243 // User disabled SB Extended Reporting via the checkbox. | 244 // User disabled SB Extended Reporting via the checkbox. |
244 SetReportingPreference(false); | 245 controller()->SetReportingPreference(false); |
245 break; | 246 break; |
246 } | 247 } |
247 case security_interstitials::CMD_OPEN_HELP_CENTER: { | 248 case security_interstitials::CMD_OPEN_HELP_CENTER: { |
248 // User pressed "Learn more". | 249 // User pressed "Learn more". |
249 metrics_helper()->RecordUserInteraction( | 250 metrics_helper()->RecordUserInteraction( |
250 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); | 251 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); |
251 GURL learn_more_url(kLearnMore); | 252 GURL learn_more_url(kLearnMore); |
252 learn_more_url = google_util::AppendGoogleLocaleParam( | 253 learn_more_url = google_util::AppendGoogleLocaleParam( |
253 learn_more_url, g_browser_process->GetApplicationLocale()); | 254 learn_more_url, g_browser_process->GetApplicationLocale()); |
254 OpenURLParams params(learn_more_url, Referrer(), | 255 OpenURLParams params(learn_more_url, Referrer(), |
255 WindowOpenDisposition::CURRENT_TAB, | 256 WindowOpenDisposition::CURRENT_TAB, |
256 ui::PAGE_TRANSITION_LINK, false); | 257 ui::PAGE_TRANSITION_LINK, false); |
257 web_contents()->OpenURL(params); | 258 web_contents()->OpenURL(params); |
258 break; | 259 break; |
259 } | 260 } |
260 case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: { | 261 case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: { |
261 // User pressed on the SB Extended Reporting "privacy policy" link. | 262 // User pressed on the SB Extended Reporting "privacy policy" link. |
262 OpenExtendedReportingPrivacyPolicy(); | 263 controller()->OpenExtendedReportingPrivacyPolicy(); |
263 break; | 264 break; |
264 } | 265 } |
265 case security_interstitials::CMD_PROCEED: { | 266 case security_interstitials::CMD_PROCEED: { |
266 // User pressed on the button to proceed. | 267 // User pressed on the button to proceed. |
267 if (!IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { | 268 if (!IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { |
268 metrics_helper()->RecordUserDecision( | 269 metrics_helper()->RecordUserDecision( |
269 security_interstitials::MetricsHelper::PROCEED); | 270 security_interstitials::MetricsHelper::PROCEED); |
270 interstitial_page()->Proceed(); | 271 interstitial_page()->Proceed(); |
271 // |this| has been deleted after Proceed() returns. | 272 // |this| has been deleted after Proceed() returns. |
272 break; | 273 break; |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, | 725 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, |
725 GetFormattedHostName())); | 726 GetFormattedHostName())); |
726 load_time_data->SetString( | 727 load_time_data->SetString( |
727 "finalParagraph", | 728 "finalParagraph", |
728 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); | 729 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); |
729 | 730 |
730 PopulateExtendedReportingOption(load_time_data); | 731 PopulateExtendedReportingOption(load_time_data); |
731 } | 732 } |
732 | 733 |
733 } // namespace safe_browsing | 734 } // namespace safe_browsing |
OLD | NEW |