Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: components/security_interstitials/core/safe_browsing_loud_error_ui.cc

Issue 2890703002: SafeBrowsing: allow WebView to customize the Help Center URL (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
25 // p= URL query parameter for the Safe Browsing article
26 const char kDefaultPlink[] = "cpn_safe_browsing";
24 27
25 // For malware interstitial pages, we link the problematic URL to Google's 28 // For malware interstitial pages, we link the problematic URL to Google's
26 // diagnostic page. 29 // diagnostic page.
27 #if defined(GOOGLE_CHROME_BUILD) 30 #if defined(GOOGLE_CHROME_BUILD)
28 const char kSbDiagnosticUrl[] = 31 const char kSbDiagnosticUrl[] =
29 "https://www.google.com/safebrowsing/" 32 "https://www.google.com/safebrowsing/"
30 "diagnostic?site=%s&client=googlechrome"; 33 "diagnostic?site=%s&client=googlechrome";
31 #else 34 #else
32 const char kSbDiagnosticUrl[] = 35 const char kSbDiagnosticUrl[] =
33 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=chromium"; 36 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=chromium";
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 case CMD_SHOW_MORE_SECTION: { 161 case CMD_SHOW_MORE_SECTION: {
159 controller()->metrics_helper()->RecordUserInteraction( 162 controller()->metrics_helper()->RecordUserInteraction(
160 security_interstitials::MetricsHelper::SHOW_ADVANCED); 163 security_interstitials::MetricsHelper::SHOW_ADVANCED);
161 break; 164 break;
162 } 165 }
163 case CMD_OPEN_HELP_CENTER: { 166 case CMD_OPEN_HELP_CENTER: {
164 // User pressed "Learn more". 167 // User pressed "Learn more".
165 controller()->metrics_helper()->RecordUserInteraction( 168 controller()->metrics_helper()->RecordUserInteraction(
166 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); 169 security_interstitials::MetricsHelper::SHOW_LEARN_MORE);
167 GURL learn_more_url(kLearnMore); 170 GURL learn_more_url(kLearnMore);
171 learn_more_url = net::AppendQueryParameter(
172 learn_more_url, "p",
173 get_plink() == nullptr ? kDefaultPlink : get_plink());
168 learn_more_url = 174 learn_more_url =
169 google_util::AppendGoogleLocaleParam(learn_more_url, app_locale()); 175 google_util::AppendGoogleLocaleParam(learn_more_url, app_locale());
170 controller()->OpenUrlInCurrentTab(learn_more_url); 176 controller()->OpenUrlInCurrentTab(learn_more_url);
171 break; 177 break;
172 } 178 }
173 case CMD_RELOAD: { 179 case CMD_RELOAD: {
174 controller()->metrics_helper()->RecordUserInteraction( 180 controller()->metrics_helper()->RecordUserInteraction(
175 security_interstitials::MetricsHelper::RELOAD); 181 security_interstitials::MetricsHelper::RELOAD);
176 controller()->Reload(); 182 controller()->Reload();
177 break; 183 break;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 l10n_util::GetStringFUTF16( 302 l10n_util::GetStringFUTF16(
297 is_scout_reporting_enabled() 303 is_scout_reporting_enabled()
298 ? IDS_SAFE_BROWSING_SCOUT_REPORTING_AGREE 304 ? IDS_SAFE_BROWSING_SCOUT_REPORTING_AGREE
299 : IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE, 305 : IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE,
300 base::UTF8ToUTF16(privacy_link))); 306 base::UTF8ToUTF16(privacy_link)));
301 load_time_data->SetBoolean(security_interstitials::kBoxChecked, 307 load_time_data->SetBoolean(security_interstitials::kBoxChecked,
302 is_extended_reporting_enabled()); 308 is_extended_reporting_enabled());
303 } 309 }
304 310
305 } // security_interstitials 311 } // security_interstitials
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698