summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/chromium_strings.grd8
-rw-r--r--chrome/app/generated_resources.grd14
-rw-r--r--chrome/app/google_chrome_strings.grd8
-rw-r--r--chrome/browser/profiles/profile.cc4
-rw-r--r--chrome/browser/resources/options/browser_options.html12
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.cc47
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.h10
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc4
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc108
-rw-r--r--chrome/browser/ui/views/download/download_feedback_dialog_view.cc5
-rw-r--r--chrome/browser/ui/views/download/download_item_view.cc4
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc4
-rw-r--r--chrome/common/pref_names.cc6
-rw-r--r--chrome/common/pref_names.h1
-rw-r--r--tools/metrics/histograms/histograms.xml23
15 files changed, 209 insertions, 49 deletions
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index cd6c6aa..587ab7e 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -1213,6 +1213,14 @@ Signing in anyway will merge Chromium information like bookmarks, history, and o
<message name="IDS_UPGRADE_BUBBLE_REENABLE_TEXT" desc="Text for the upgrade bubble view full description.">
Chromium could not update itself to the latest version, so you are missing out on awesome new features and security fixes. You need to update Chromium.
</message>
+
+ <!-- Dialog that asks whether user wants to participate in Safe Browsing Extended Reporting -->
+ <message name="IDS_FEEDBACK_SERVICE_DIALOG_TITLE" desc="Title of the dialog asking whether the user wants to upload suspected malicious files for analysis">
+ Help make Chromium better
+ </message>
+ <message name="IDS_FEEDBACK_SERVICE_DIALOG_EXPLANATION" desc="Explanation of the dialog asking whether the user wants to upload suspected malicious files for analysis">
+ You can help make Chromium safer and easier to use by automatically reporting details of possible security incidents to Google.
+ </message>
</messages>
</release>
</grit>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index a6c11b5..4819f92 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -2107,13 +2107,7 @@ Even if you have downloaded files from this website before, the website might ha
No
</message>
- <!-- Dialog that asks whether user wants to participate in download feedback service -->
- <message name="IDS_FEEDBACK_SERVICE_DIALOG_TITLE" desc="Title of the dialog asking whether the user wants to upload suspected malicious files for analysis">
- Help make Chrome better
- </message>
- <message name="IDS_FEEDBACK_SERVICE_DIALOG_EXPLANATION" desc="Explanation of the dialog asking whether the user wants to upload suspected malicious files for analysis">
- You can help make Chrome safer and easier to use by sending suspicious downloaded files to Google.
- </message>
+ <!-- Dialog that asks whether user wants to participate in Safe Browsing Extended Reporting -->
<message name="IDS_FEEDBACK_SERVICE_DIALOG_OK_BUTTON_LABEL" desc="Button that elects to upload suspected malicious files for analysis">
Yes, I want to help
</message>
@@ -10055,8 +10049,8 @@ Chrome ran out of memory.
<message name="IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION" desc="The label of the 'Enable phishing and malware protection' checkbox">
Enable phishing and malware protection
</message>
- <message name="IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK" desc="Checkbox label: should Chrome upload suspicious downloads to Safe Browsing">
- Send suspicious downloaded files to Google
+ <message name="IDS_OPTIONS_SAFEBROWSING_ENABLE_EXTENDED_REPORTING" desc="Checkbox label: should Chrome upload information about suspicious downloads and websites to Safe Browsing">
+ Automatically report details of possible security incidents to Google
</message>
<if expr="chromeos">
@@ -11429,7 +11423,7 @@ Chrome ran out of memory.
http://www.google.com/chrome/intl/[GRITLANGCODE]/privacy.html
</message>
<message name="IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE" desc="SafeBrowsing Malware v2 Details label next to checkbox">
- Improve malware detection by sending additional data to Google when I encounter warnings like this. <ph name="PRIVACY_PAGE_LINK">$1</ph>
+ Automatically report details of possible security incidents to Google. <ph name="PRIVACY_PAGE_LINK">$1</ph>
</message>
<message name="IDS_SAFE_BROWSING_PHISHING_TITLE" desc="SafeBrowsing Phishing HTML title">
Phishing Detected!
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 097a8eb..6dfbd75 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -1138,6 +1138,14 @@ Signing in anyway will merge Chrome information like bookmarks, history, and oth
<message name="IDS_UPGRADE_BUBBLE_REENABLE_TEXT" desc="Text for the upgrade bubble view full description.">
Chrome could not update itself to the latest version, so you are missing out on awesome new features and security fixes. You need to update Chrome.
</message>
+
+ <!-- Dialog that asks whether user wants to participate in Safe Browsing Extended Reporting -->
+ <message name="IDS_FEEDBACK_SERVICE_DIALOG_TITLE" desc="Title of the dialog asking whether the user wants to upload suspected malicious files for analysis">
+ Help make Chrome better
+ </message>
+ <message name="IDS_FEEDBACK_SERVICE_DIALOG_EXPLANATION" desc="Explanation of the dialog asking whether the user wants to upload suspected malicious files for analysis">
+ You can help make Chrome safer and easier to use by automatically reporting details of possible security incidents to Google.
+ </message>
</messages>
</release>
</grit>
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index b7d6601..39e1767 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -99,6 +99,10 @@ void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#endif
registry->RegisterBooleanPref(
+ prefs::kSafeBrowsingExtendedReportingEnabled,
+ false,
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterBooleanPref(
prefs::kSafeBrowsingDownloadFeedbackEnabled,
false,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html
index 83ac8f5..0386da5 100644
--- a/chrome/browser/resources/options/browser_options.html
+++ b/chrome/browser/resources/options/browser_options.html
@@ -301,16 +301,16 @@
</div>
<div class="checkbox">
<span class="controlled-setting-with-label">
- <input id="safe-browsing-download-feedback-enabled"
- metric="Options_SafeBrowsingDownloadFeedbackCheckbox"
- pref="safebrowsing.download_feedback_enabled"
+ <input id="safe-browsing-extended-reporting-enabled"
+ metric="Options_SafeBrowsingExtendedReportingCheckbox"
+ pref="safebrowsing.extended_reporting_enabled"
type="checkbox">
<span>
- <label for="safe-browsing-download-feedback-enabled"
- i18n-content="safeBrowsingEnableDownloadFeedback">
+ <label for="safe-browsing-extended-reporting-enabled"
+ i18n-content="safeBrowsingEnableExtendedReporting">
</label>
<span class="controlled-setting-indicator"
- pref="safebrowsing.download_feedback_enabled">
+ pref="safebrowsing.extended_reporting_enabled">
</span>
</span>
</span>
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index df8a9e5..a4af044 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -239,6 +239,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
web_contents_(web_contents),
url_(unsafe_resources[0].url),
has_expanded_see_more_section_(false),
+ reporting_checkbox_checked_(false),
num_visits_(-1) {
bool malware = false;
bool phishing = false;
@@ -487,13 +488,33 @@ void SafeBrowsingBlockingPage::SetReportingPreference(bool report) {
Profile* profile = Profile::FromBrowserContext(
web_contents_->GetBrowserContext());
PrefService* pref = profile->GetPrefs();
- pref->SetBoolean(prefs::kSafeBrowsingReportingEnabled, report);
- UMA_HISTOGRAM_BOOLEAN("SB2.SetReportingEnabled", report);
+ pref->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled, report);
+ UMA_HISTOGRAM_BOOLEAN("SB2.SetExtendedReportingEnabled", report);
+ reporting_checkbox_checked_ = report;
+ pref->ClearPref(prefs::kSafeBrowsingReportingEnabled);
+ pref->ClearPref(prefs::kSafeBrowsingDownloadFeedbackEnabled);
+}
+
+// If the reporting checkbox was left checked on close, the new pref
+// kSafeBrowsingExtendedReportingEnabled should be updated.
+// TODO(felt): Remove this in M-39. crbug.com/384668
+void SafeBrowsingBlockingPage::UpdateReportingPref() {
+ if (!reporting_checkbox_checked_)
+ return;
+ if (IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled))
+ return;
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents_->GetBrowserContext());
+ if (profile->GetPrefs()->HasPrefPath(
+ prefs::kSafeBrowsingExtendedReportingEnabled))
+ return;
+ SetReportingPreference(true);
}
void SafeBrowsingBlockingPage::OnProceed() {
proceeded_ = true;
RecordUserAction(PROCEED);
+ UpdateReportingPref();
// Send the malware details, if we opted to.
FinishMalwareDetails(malware_details_proceed_delay_ms_);
@@ -527,6 +548,7 @@ void SafeBrowsingBlockingPage::OnDontProceed() {
return;
RecordUserAction(DONT_PROCEED);
+ UpdateReportingPref();
// Send the malware details, if we opted to.
FinishMalwareDetails(0); // No delay
@@ -800,8 +822,9 @@ void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) {
if (malware_details_.get() == NULL)
return; // Not all interstitials have malware details (eg phishing).
- const bool enabled = IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled);
- UMA_HISTOGRAM_BOOLEAN("SB2.ReportingIsEnabled", enabled);
+ const bool enabled =
+ IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled);
+ UMA_HISTOGRAM_BOOLEAN("SB2.ExtendedReportingIsEnabled", enabled);
if (enabled) {
// Finish the malware details collection, send it over.
BrowserThread::PostDelayedTask(
@@ -1195,10 +1218,18 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary(
l10n_util::GetStringFUTF16(
IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE,
base::UTF8ToUTF16(privacy_link)));
- if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled))
- strings->SetString(kBoxChecked, "yes");
- else
- strings->SetString(kBoxChecked, std::string());
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents_->GetBrowserContext());
+ if (profile->GetPrefs()->HasPrefPath(
+ prefs::kSafeBrowsingExtendedReportingEnabled)) {
+ reporting_checkbox_checked_ =
+ IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled);
+ } else if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled) ||
+ IsPrefEnabled(prefs::kSafeBrowsingDownloadFeedbackEnabled)) {
+ reporting_checkbox_checked_ = true;
+ }
+ strings->SetString(kBoxChecked,
+ reporting_checkbox_checked_ ? "yes" : std::string());
}
strings->SetString("report_error", base::string16());
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
index 43ac464..eccd1a0 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
@@ -90,6 +90,7 @@ class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate {
ProceedThenDontProceed);
void SetReportingPreference(bool report);
+ void UpdateReportingPref(); // Used for the transition from old to new pref.
// Don't instanciate this class directly, use ShowBlockingPage instead.
SafeBrowsingBlockingPage(SafeBrowsingUIManager* ui_manager,
@@ -105,8 +106,10 @@ class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate {
return interstitial_page_;
}
- FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, MalwareReports);
- FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageV2Test, MalwareReports);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest,
+ MalwareReportsTransitionDisabled);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest,
+ MalwareReportsToggling);
enum BlockingPageEvent {
SHOW,
@@ -200,6 +203,9 @@ class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate {
// during this interstitial page.
bool has_expanded_see_more_section_;
+ // Whether the user has left the reporting checkbox checked.
+ bool reporting_checkbox_checked_;
+
// Which type of interstitial this is.
enum {
TYPE_MALWARE,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index 275df6d2..1a96ed1 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -776,7 +776,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
LOG(INFO) << "5";
ASSERT_TRUE(browser()->profile()->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingReportingEnabled));
+ prefs::kSafeBrowsingExtendedReportingEnabled));
LOG(INFO) << "6";
EXPECT_EQ(url,
@@ -835,7 +835,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) {
#endif
browser()->profile()->GetPrefs()->SetBoolean(
- prefs::kSafeBrowsingReportingEnabled, true);
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
net::SpawnedTestServer https_server(
net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index da5a3ca..f0df24c 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -239,7 +239,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) {
// Enable malware details.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Start a load.
controller().LoadURL(GURL(kBadURL), content::Referrer(),
@@ -273,7 +274,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageProceed) {
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Start a load.
controller().LoadURL(GURL(kBadURL), content::Referrer(),
@@ -305,7 +307,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceDontProceed) {
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Navigate somewhere.
Navigate(kGoogleURL, 1);
@@ -340,7 +343,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceProceed) {
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Navigate somewhere.
Navigate(kGoodURL, 1);
@@ -373,7 +377,8 @@ TEST_F(SafeBrowsingBlockingPageTest,
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Navigate somewhere.
Navigate(kGoogleURL, 1);
@@ -414,7 +419,8 @@ TEST_F(SafeBrowsingBlockingPageTest,
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Navigate somewhere.
Navigate(kGoogleURL, 1);
@@ -470,7 +476,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) {
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Navigate somewhere else.
Navigate(kGoodURL, 1);
@@ -521,7 +528,8 @@ TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) {
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Navigate somewhere.
Navigate(kGoodURL, 1);
@@ -569,7 +577,8 @@ TEST_F(SafeBrowsingBlockingPageTest, ProceedThenDontProceed) {
// Enable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, true);
// Start a load.
controller().LoadURL(GURL(kBadURL), content::Referrer(),
@@ -604,7 +613,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsDisabled) {
// Disable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, false);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, false);
// Start a load.
controller().LoadURL(GURL(kBadURL), content::Referrer(),
@@ -632,12 +642,13 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsDisabled) {
ui_manager_->GetDetails()->clear();
}
-// Test setting the malware report preferance
-TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) {
+// Test that toggling the checkbox has the anticipated effects.
+TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsToggling) {
// Disable malware reports.
Profile* profile = Profile::FromBrowserContext(
web_contents()->GetBrowserContext());
- profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, false);
+ profile->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled, false);
// Start a load.
controller().LoadURL(GURL(kBadURL), content::Referrer(),
@@ -651,17 +662,84 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) {
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingReportingEnabled));
+ prefs::kSafeBrowsingExtendedReportingEnabled));
// Simulate the user check the report agreement checkbox.
sb_interstitial->SetReportingPreference(true);
EXPECT_TRUE(profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingReportingEnabled));
+ prefs::kSafeBrowsingExtendedReportingEnabled));
+
+ // Simulate the user uncheck the report agreement checkbox.
+ sb_interstitial->SetReportingPreference(false);
+
+ EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled));
+}
+
+// Test that the transition from old to new preference works.
+TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsTransitionEnabled) {
+ // The old pref is enabled.
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents()->GetBrowserContext());
+ profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+
+ // Start a load.
+ controller().LoadURL(GURL(kBadURL), content::Referrer(),
+ content::PAGE_TRANSITION_TYPED, std::string());
+
+ // Simulate the load causing a safe browsing interstitial to be shown.
+ ShowInterstitial(false, kBadURL);
+ SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
+ ASSERT_TRUE(sb_interstitial);
+
+ base::RunLoop().RunUntilIdle();
+
+ // At this point, nothing should have changed yet.
+ EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled));
+
+ ProceedThroughInterstitial(sb_interstitial);
+
+ // Since the user has proceeded without changing the checkbox, the new pref
+ // has been updated.
+ EXPECT_TRUE(profile->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled));
+}
+
+// Test that the transition from old to new preference still respects the
+// user's checkbox preferences.
+TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsTransitionDisabled) {
+ // The old pref is enabled.
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents()->GetBrowserContext());
+ profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true);
+
+ // Start a load.
+ controller().LoadURL(GURL(kBadURL), content::Referrer(),
+ content::PAGE_TRANSITION_TYPED, std::string());
+
+ // Simulate the load causing a safe browsing interstitial to be shown.
+ ShowInterstitial(false, kBadURL);
+ SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
+ ASSERT_TRUE(sb_interstitial);
+
+ base::RunLoop().RunUntilIdle();
+
+ // At this point, nothing should have changed yet.
+ EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled));
// Simulate the user uncheck the report agreement checkbox.
sb_interstitial->SetReportingPreference(false);
+ ProceedThroughInterstitial(sb_interstitial);
+
+ // The new pref is turned off.
+ EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingExtendedReportingEnabled));
EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
prefs::kSafeBrowsingReportingEnabled));
+ EXPECT_FALSE(profile->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingDownloadFeedbackEnabled));
}
diff --git a/chrome/browser/ui/views/download/download_feedback_dialog_view.cc b/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
index 0164ec5..ccdfadd 100644
--- a/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
+++ b/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
@@ -9,6 +9,7 @@
#include "base/supports_user_data.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
+#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/message_box_view.h"
@@ -37,7 +38,7 @@ void DownloadFeedbackDialogView::Show(
const UserDecisionCallback& callback) {
// This dialog should only be shown if it hasn't been shown before.
DCHECK(!profile->GetPrefs()->HasPrefPath(
- prefs::kSafeBrowsingDownloadFeedbackEnabled));
+ prefs::kSafeBrowsingExtendedReportingEnabled));
// Only one dialog should be shown at a time, so check to see if another one
// is open. If another one is open, treat this parallel call as if reporting
@@ -86,7 +87,7 @@ base::string16 DownloadFeedbackDialogView::GetDialogButtonLabel(
}
bool DownloadFeedbackDialogView::OnButtonClicked(bool accepted) {
- profile_->GetPrefs()->SetBoolean(prefs::kSafeBrowsingDownloadFeedbackEnabled,
+ profile_->GetPrefs()->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled,
accepted);
DialogStatusData* data =
static_cast<DialogStatusData*>(profile_->GetUserData(kDialogStatusKey));
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 4db589a..d0e531a 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -556,7 +556,7 @@ void DownloadItemView::ButtonPressed(views::Button* sender,
if (model_.ShouldAllowDownloadFeedback() &&
!shelf_->browser()->profile()->IsOffTheRecord()) {
if (!shelf_->browser()->profile()->GetPrefs()->HasPrefPath(
- prefs::kSafeBrowsingDownloadFeedbackEnabled)) {
+ prefs::kSafeBrowsingExtendedReportingEnabled)) {
// Show dialog, because the dialog hasn't been shown before.
DownloadFeedbackDialogView::Show(
shelf_->get_parent()->GetNativeWindow(),
@@ -567,7 +567,7 @@ void DownloadItemView::ButtonPressed(views::Button* sender,
} else {
PossiblySubmitDownloadToFeedbackService(
shelf_->browser()->profile()->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingDownloadFeedbackEnabled));
+ prefs::kSafeBrowsingExtendedReportingEnabled));
}
return;
}
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 4e0d66d..4b632fd 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -303,8 +303,8 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE },
{ "safeBrowsingEnableProtection",
IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION },
- { "safeBrowsingEnableDownloadFeedback",
- IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK },
+ { "safeBrowsingEnableExtendedReporting",
+ IDS_OPTIONS_SAFEBROWSING_ENABLE_EXTENDED_REPORTING },
{ "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME },
{ "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME },
{ "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME },
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 9fc4a7d..ab0b57d 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -293,10 +293,16 @@ const char kWebKitPluginsEnabled[] = "webkit.webprefs.plugins_enabled";
const char kSafeBrowsingEnabled[] = "safebrowsing.enabled";
// Boolean that tell us whether malicious download feedback is enabled.
+const char kSafeBrowsingExtendedReportingEnabled[] =
+ "safebrowsing.extended_reporting_enabled";
+
+// Boolean that tell us whether malicious download feedback is enabled.
+// TODO(felt): Deprecate. crbug.com/383866
const char kSafeBrowsingDownloadFeedbackEnabled[] =
"safebrowsing.download_feedback_enabled";
// Boolean that is true when SafeBrowsing Malware Report is enabled.
+// TODO(felt): Deprecate. crbug.com/383866
const char kSafeBrowsingReportingEnabled[] =
"safebrowsing.reporting_enabled";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 83af07a..db04800a 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -132,6 +132,7 @@ extern const char kWebKitForceEnableZoom[];
extern const char kWebKitPasswordEchoEnabled[];
#endif
extern const char kSafeBrowsingEnabled[];
+extern const char kSafeBrowsingExtendedReportingEnabled[];
extern const char kSafeBrowsingDownloadFeedbackEnabled[];
extern const char kSafeBrowsingReportingEnabled[];
extern const char kSafeBrowsingProceedAnywayDisabled[];
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index e0710b1..cf6ecc0 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -23924,6 +23924,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<summary>Records results of SafeBrowsing download url check.</summary>
</histogram>
+<histogram name="SB2.ExtendedReportingIsEnabled" enum="BooleanEnabled">
+ <owner>felt@chromium.org</owner>
+ <summary>
+ Whether the user has Safe Browsing extended reporting enabled at the time a
+ Safe Browsing warning was dismissed. This tracks the fraction of all SB
+ interstitials that had reporting enabled.
+ </summary>
+</histogram>
+
<histogram name="SB2.FailedUpdate">
<obsolete>
Deprecated, replaced by SB2.DatabaseFailure BROWSE_DB_UPDATE_FINISH.
@@ -24326,6 +24335,9 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram>
<histogram name="SB2.ReportingIsEnabled" enum="BooleanEnabled">
+ <obsolete>
+ Deprecated 06/2014. Replaced by SB2.ExtendedReportingIsEnabled.
+ </obsolete>
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>
Whether the user has Safe Browsing extended reporting enabled at the time a
@@ -24334,7 +24346,18 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
+<histogram name="SB2.SetExtendedReportingEnabled" enum="BooleanEnabled">
+ <owner>felt@chromium.org</owner>
+ <summary>
+ Tracks changes to the Safe Browsing extended reporting opt-in which is shown
+ in the Safe Browsing interstitial.
+ </summary>
+</histogram>
+
<histogram name="SB2.SetReportingEnabled" enum="BooleanEnabled">
+ <obsolete>
+ Deprecated 06/2014. Replaced by SB2.SetExtendedReportingEnabled.
+ </obsolete>
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>
Tracks changes to the Safe Browsing extended reporting opt-in which is shown