Skip to content

Commit

Permalink
Update links for the SBER opt-in on interstitials
Browse files Browse the repository at this point in the history
BUG=639166
TBR=mpearson@chromium.org

Review-Url: https://codereview.chromium.org/2330753002
Cr-Commit-Position: refs/heads/master@{#418146}
  • Loading branch information
adrifelt authored and Commit bot committed Sep 13, 2016
1 parent 6d9ffa0 commit 4f76c4d
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -9110,7 +9110,7 @@ I don't think this site should be blocked!
Privacy policy
</message>
<message name="IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE" desc="SafeBrowsing Malware v2 Details label next to checkbox">
Automatically report details of possible security incidents to Google. <ph name="PRIVACY_PAGE_LINK">$1</ph>
<ph name="BEGIN_WHITEPAPER_LINK">&lt;a href="#" id="whitepaper-link"&gt;</ph>Automatically report<ph name="END_WHITEPAPER_LINK">&lt;/a&gt;</ph> details of possible security incidents to Google. <ph name="PRIVACY_PAGE_LINK">$1</ph>
</message>

<!-- Harmful download interstitial V3 -->
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/interstitials/chrome_metrics_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void ChromeMetricsHelper::RecordExtraUserInteractionMetrics(
case SET_EXTENDED_REPORTING_DISABLED:
case EXTENDED_REPORTING_IS_ENABLED:
case REPORT_PHISHING_ERROR:
case SHOW_WHITEPAPER:
case MAX_INTERACTION:
break;
}
Expand Down
3 changes: 3 additions & 0 deletions components/security_interstitials/core/bad_clock_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ void BadClockUI::HandleCommand(SecurityInterstitialCommands command) {
case CMD_OPEN_REPORTING_PRIVACY:
controller_->OpenExtendedReportingPrivacyPolicy();
break;
case CMD_OPEN_WHITEPAPER:
controller_->OpenExtendedReportingWhitepaper();
break;
case CMD_PROCEED:
case CMD_OPEN_HELP_CENTER:
case CMD_RELOAD:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ function setupExtendedReportingCheckbox() {

$('body').classList.add('extended-reporting-has-checkbox');

if ($('whitepaper-link')) {
$('whitepaper-link').addEventListener('click', function(event) {
sendCommand(CMD_OPEN_WHITEPAPER);
});
}

$('opt-in-checkbox').addEventListener('click', function() {
sendCommand($('opt-in-checkbox').checked ?
CMD_DO_REPORT :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ var CMD_OPEN_LOGIN = 7;
var CMD_DO_REPORT = 8;
var CMD_DONT_REPORT = 9;
var CMD_OPEN_REPORTING_PRIVACY = 10;
var CMD_OPEN_WHITEPAPER = 11;
// Report a phishing error.
var CMD_REPORT_PHISHING_ERROR = 11;
var CMD_REPORT_PHISHING_ERROR = 12;

/**
* A convenience method for sending commands to the parent page.
Expand Down
9 changes: 9 additions & 0 deletions components/security_interstitials/core/controller_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@ void ControllerClient::OpenExtendedReportingPrivacyPolicy() {
OpenUrlInCurrentTab(privacy_url);
}

void ControllerClient::OpenExtendedReportingWhitepaper() {
metrics_helper_->RecordUserInteraction(MetricsHelper::SHOW_WHITEPAPER);
GURL whitepaper_url(
l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_WHITEPAPER_URL));
whitepaper_url = google_util::AppendGoogleLocaleParam(whitepaper_url,
GetApplicationLocale());
OpenUrlInCurrentTab(whitepaper_url);
}

} // namespace security_interstitials
4 changes: 3 additions & 1 deletion components/security_interstitials/core/controller_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ enum SecurityInterstitialCommands {
CMD_DO_REPORT = 8,
CMD_DONT_REPORT = 9,
CMD_OPEN_REPORTING_PRIVACY = 10,
CMD_OPEN_WHITEPAPER = 11,
// Report a phishing error
CMD_REPORT_PHISHING_ERROR = 11,
CMD_REPORT_PHISHING_ERROR = 12,
};

// Provides methods for handling commands from the user, which requires some
Expand All @@ -61,6 +62,7 @@ class ControllerClient {
// Handle the user's reporting preferences.
void SetReportingPreference(bool report);
void OpenExtendedReportingPrivacyPolicy();
void OpenExtendedReportingWhitepaper();

// If available, open the operating system's date/time settings.
virtual bool CanLaunchDateAndTimeSettings() = 0;
Expand Down
1 change: 1 addition & 0 deletions components/security_interstitials/core/metrics_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class MetricsHelper {
SET_EXTENDED_REPORTING_DISABLED,
EXTENDED_REPORTING_IS_ENABLED,
REPORT_PHISHING_ERROR,
SHOW_WHITEPAPER,
MAX_INTERACTION
};

Expand Down
3 changes: 3 additions & 0 deletions components/security_interstitials/core/ssl_error_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ void SSLErrorUI::HandleCommand(SecurityInterstitialCommands command) {
case CMD_OPEN_REPORTING_PRIVACY:
controller_->OpenExtendedReportingPrivacyPolicy();
break;
case CMD_OPEN_WHITEPAPER:
controller_->OpenExtendedReportingWhitepaper();
break;
case CMD_OPEN_DATE_SETTINGS:
case CMD_OPEN_DIAGNOSTIC:
case CMD_OPEN_LOGIN:
Expand Down
5 changes: 4 additions & 1 deletion components/security_interstitials_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@

<!-- Extended reporting strings -->
<message name="IDS_SAFE_BROWSING_PRIVACY_POLICY_URL" translateable="false">
https://www.google.com/chrome/browser/privacy/#safe-browsing-policies
</message>
<message name="IDS_SAFE_BROWSING_WHITEPAPER_URL" translateable="false">
https://www.google.com/chrome/browser/privacy/whitepaper.html#malware
</message>

Expand Down Expand Up @@ -103,4 +106,4 @@
</message>
</if>

</grit-part>
</grit-part>
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93951,6 +93951,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="8" label="SET_EXTENDED_REPORTING_DISABLED"/>
<int value="9" label="EXTENDED_REPORTING_IS_ENABLED"/>
<int value="10" label="REPORT_PHISHING_ERROR"/>
<int value="11" label="SHOW_WHITEPAPER"/>
</enum>

<enum name="ServiceProcessEventType" type="int">
Expand Down

0 comments on commit 4f76c4d

Please sign in to comment.