OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/security_interstitials/core/safe_browsing_loud_error_ui.h" | 5 #include "components/security_interstitials/core/safe_browsing_loud_error_ui.h" |
6 | 6 |
7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "components/google/core/browser/google_util.h" | 11 #include "components/google/core/browser/google_util.h" |
12 #include "components/security_interstitials/core/common_string_util.h" | 12 #include "components/security_interstitials/core/common_string_util.h" |
13 #include "components/security_interstitials/core/metrics_helper.h" | 13 #include "components/security_interstitials/core/metrics_helper.h" |
14 #include "components/strings/grit/components_strings.h" | 14 #include "components/strings/grit/components_strings.h" |
15 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
| 16 #include "net/base/url_util.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 namespace security_interstitials { | 19 namespace security_interstitials { |
19 namespace { | 20 namespace { |
20 | 21 |
21 // URL for the Help Center article on Safe Browsing warnings. | 22 // URL for the Help Center |
22 const char kLearnMore[] = | 23 const char kLearnMore[] = "https://support.google.com/chrome/"; |
23 "https://support.google.com/chrome/?p=cpn_safe_browsing"; | |
24 | 24 |
25 // For malware interstitial pages, we link the problematic URL to Google's | 25 // For malware interstitial pages, we link the problematic URL to Google's |
26 // diagnostic page. | 26 // diagnostic page. |
27 #if defined(GOOGLE_CHROME_BUILD) | 27 #if defined(GOOGLE_CHROME_BUILD) |
28 const char kSbDiagnosticUrl[] = | 28 const char kSbDiagnosticUrl[] = |
29 "https://www.google.com/safebrowsing/" | 29 "https://www.google.com/safebrowsing/" |
30 "diagnostic?site=%s&client=googlechrome"; | 30 "diagnostic?site=%s&client=googlechrome"; |
31 #else | 31 #else |
32 const char kSbDiagnosticUrl[] = | 32 const char kSbDiagnosticUrl[] = |
33 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=chromium"; | 33 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=chromium"; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 case CMD_SHOW_MORE_SECTION: { | 158 case CMD_SHOW_MORE_SECTION: { |
159 controller()->metrics_helper()->RecordUserInteraction( | 159 controller()->metrics_helper()->RecordUserInteraction( |
160 security_interstitials::MetricsHelper::SHOW_ADVANCED); | 160 security_interstitials::MetricsHelper::SHOW_ADVANCED); |
161 break; | 161 break; |
162 } | 162 } |
163 case CMD_OPEN_HELP_CENTER: { | 163 case CMD_OPEN_HELP_CENTER: { |
164 // User pressed "Learn more". | 164 // User pressed "Learn more". |
165 controller()->metrics_helper()->RecordUserInteraction( | 165 controller()->metrics_helper()->RecordUserInteraction( |
166 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); | 166 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); |
167 GURL learn_more_url(kLearnMore); | 167 GURL learn_more_url(kLearnMore); |
| 168 learn_more_url = net::AppendQueryParameter( |
| 169 learn_more_url, "p", get_help_center_article_link()); |
168 learn_more_url = | 170 learn_more_url = |
169 google_util::AppendGoogleLocaleParam(learn_more_url, app_locale()); | 171 google_util::AppendGoogleLocaleParam(learn_more_url, app_locale()); |
170 controller()->OpenUrlInCurrentTab(learn_more_url); | 172 controller()->OpenUrlInCurrentTab(learn_more_url); |
171 break; | 173 break; |
172 } | 174 } |
173 case CMD_RELOAD: { | 175 case CMD_RELOAD: { |
174 controller()->metrics_helper()->RecordUserInteraction( | 176 controller()->metrics_helper()->RecordUserInteraction( |
175 security_interstitials::MetricsHelper::RELOAD); | 177 security_interstitials::MetricsHelper::RELOAD); |
176 controller()->Reload(); | 178 controller()->Reload(); |
177 break; | 179 break; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 l10n_util::GetStringFUTF16( | 298 l10n_util::GetStringFUTF16( |
297 is_scout_reporting_enabled() | 299 is_scout_reporting_enabled() |
298 ? IDS_SAFE_BROWSING_SCOUT_REPORTING_AGREE | 300 ? IDS_SAFE_BROWSING_SCOUT_REPORTING_AGREE |
299 : IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE, | 301 : IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE, |
300 base::UTF8ToUTF16(privacy_link))); | 302 base::UTF8ToUTF16(privacy_link))); |
301 load_time_data->SetBoolean(security_interstitials::kBoxChecked, | 303 load_time_data->SetBoolean(security_interstitials::kBoxChecked, |
302 is_extended_reporting_enabled()); | 304 is_extended_reporting_enabled()); |
303 } | 305 } |
304 | 306 |
305 } // security_interstitials | 307 } // security_interstitials |
OLD | NEW |