diff options
author | felt <felt@chromium.org> | 2014-09-02 12:28:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-02 19:31:39 +0000 |
commit | a55ae06b3a59bc1b9b97ef432adff20073b884a5 (patch) | |
tree | 9795a3a43cbc1838c630a2c60a5d61e669acfe0b | |
parent | 00ba9356a77a2da779b0a25612166024f674399e (diff) | |
download | chromium_src-a55ae06b3a59bc1b9b97ef432adff20073b884a5.zip chromium_src-a55ae06b3a59bc1b9b97ef432adff20073b884a5.tar.gz chromium_src-a55ae06b3a59bc1b9b97ef432adff20073b884a5.tar.bz2 |
Deprecate old Safe Browsing reporting opt-ins
The old prefs are no longer needed; M39 should be a sufficiently long
transition time period.
BUG=384668
R=mattm@chromium.org
Review URL: https://codereview.chromium.org/512083002
Cr-Commit-Position: refs/heads/master@{#292974}
-rw-r--r-- | chrome/browser/profiles/profile.cc | 8 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc | 35 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_blocking_page.h | 3 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc | 69 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 12 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 2 |
6 files changed, 3 insertions, 126 deletions
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 5b6162d..17f3723 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -106,14 +106,6 @@ void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { false, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterBooleanPref( - prefs::kSafeBrowsingDownloadFeedbackEnabled, - false, - user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); - registry->RegisterBooleanPref( - prefs::kSafeBrowsingReportingEnabled, - false, - user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); - registry->RegisterBooleanPref( prefs::kSafeBrowsingProceedAnywayDisabled, false, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 20c2c35..b859f73 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -189,7 +189,6 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( url_(unsafe_resources[0].url), interstitial_page_(NULL), has_expanded_see_more_section_(false), - reporting_checkbox_checked_(false), create_view_(true), num_visits_(-1) { bool malware = false; @@ -457,31 +456,11 @@ void SafeBrowsingBlockingPage::SetReportingPreference(bool report) { PrefService* pref = profile->GetPrefs(); 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_); @@ -534,7 +513,6 @@ void SafeBrowsingBlockingPage::OnDontProceed() { return; RecordUserAction(DONT_PROCEED); - UpdateReportingPref(); // Send the malware details, if we opted to. FinishMalwareDetails(0); // No delay @@ -944,18 +922,9 @@ void SafeBrowsingBlockingPage::PopulateMalwareLoadTimeData( "optInLink", l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE, base::UTF8ToUTF16(privacy_link))); - 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; - } load_time_data->SetBoolean( - kBoxChecked, reporting_checkbox_checked_); + kBoxChecked, + IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled)); } } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h index 640677a..567cac4 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h @@ -214,9 +214,6 @@ 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_; - // Whether the interstitial should create a view. bool create_view_; 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 664a6b7..3043a95 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -664,72 +664,3 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsToggling) { 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/common/pref_names.cc b/chrome/common/pref_names.cc index db5d644..c726956 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -323,20 +323,10 @@ const char kWebKitPluginsEnabled[] = "webkit.webprefs.plugins_enabled"; // Boolean that is true when SafeBrowsing is enabled. const char kSafeBrowsingEnabled[] = "safebrowsing.enabled"; -// Boolean that tell us whether malicious download feedback is enabled. +// Boolean that tell us whether Safe Browsing extended reporting 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"; - // Boolean that is true when the SafeBrowsing interstitial should not allow // users to proceed anyway. const char kSafeBrowsingProceedAnywayDisabled[] = diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 2852c55..8bed38e 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -139,8 +139,6 @@ 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[]; extern const char kSafeBrowsingIncidentReportSent[]; extern const char kSafeBrowsingIncidentsSent[]; |