Remove unused histogram and pref from data reduction proxy

This histogram is no longer in use.

Change-Id: I0ceb27f32bc8036fa5308420c6f07daba1992fc7
Bug: 984242
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815720
Reviewed-by: Michael Crouse <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Commit-Queue: Tarun Bansal <[email protected]>
Cr-Commit-Position: refs/heads/master@{#698588}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index ec07769..cfc3dfc9 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -499,6 +499,8 @@
 // Deprecated 9/2019
 const char kGoogleServicesUsername[] = "google.services.username";
 const char kGoogleServicesUserAccountId[] = "google.services.user_account_id";
+const char kDataReductionProxySavingsClearedNegativeSystemClock[] =
+    "data_reduction.savings_cleared_negative_system_clock";
 
 // Register prefs used only for migration (clearing or moving to a new key).
 void RegisterProfilePrefsForMigration(
@@ -578,6 +580,8 @@
   registry->RegisterDictionaryPref(kHintLoadedCounts);
   registry->RegisterStringPref(kGoogleServicesUsername, std::string());
   registry->RegisterStringPref(kGoogleServicesUserAccountId, std::string());
+  registry->RegisterInt64Pref(
+      kDataReductionProxySavingsClearedNegativeSystemClock, 0);
 }
 
 }  // namespace
@@ -1191,4 +1195,6 @@
   // Added 9/2019
   profile_prefs->ClearPref(kGoogleServicesUsername);
   profile_prefs->ClearPref(kGoogleServicesUserAccountId);
+  profile_prefs->ClearPref(
+      kDataReductionProxySavingsClearedNegativeSystemClock);
 }
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
index a7e9789..be304c1 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
@@ -676,9 +676,6 @@
     if (days_since_last_update < -1) {
       RecordSavingsClearedMetric(
           DataReductionProxySavingsClearedReason::SYSTEM_CLOCK_MOVED_BACK);
-      pref_service_->SetInt64(
-          prefs::kDataReductionProxySavingsClearedNegativeSystemClock,
-          now.ToInternalValue());
     }
   }
 
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
index 4f8446d..27a95bf 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
@@ -654,8 +654,6 @@
   histogram_tester.ExpectUniqueSample(
       "DataReductionProxy.SavingsCleared.Reason",
       DataReductionProxySavingsClearedReason::SYSTEM_CLOCK_MOVED_BACK, 1);
-  VerifyPrefInt64(prefs::kDataReductionProxySavingsClearedNegativeSystemClock,
-                  FakeNow().ToInternalValue());
 
   // Backward another two days, expect SYSTEM_CLOCK_MOVED_BACK.
   SetFakeTimeDeltaInHours(-4 * 24);
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.cc
index 2abe2767..fd687e4 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.cc
@@ -22,8 +22,6 @@
                                 false);
 
   registry->RegisterInt64Pref(prefs::kDataReductionProxyLastEnabledTime, 0L);
-  registry->RegisterInt64Pref(
-      prefs::kDataReductionProxySavingsClearedNegativeSystemClock, 0);
 
   registry->RegisterBooleanPref(prefs::kDataUsageReportingEnabled, false);
 
@@ -70,8 +68,6 @@
 void RegisterPrefs(PrefRegistrySimple* registry) {
   registry->RegisterStringPref(prefs::kDataReductionProxy, std::string());
   registry->RegisterInt64Pref(prefs::kDataReductionProxyLastEnabledTime, 0L);
-  registry->RegisterInt64Pref(
-      prefs::kDataReductionProxySavingsClearedNegativeSystemClock, 0);
   registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0);
   registry->RegisterInt64Pref(
       prefs::kHttpOriginalContentLength, 0);
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
index 8e532c4..6d285cd9 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
@@ -244,22 +244,6 @@
           (clock_->Now() - base::Time::FromInternalValue(last_enabled_time))
               .InDays());
     }
-
-    int64_t last_savings_cleared_time = prefs->GetInt64(
-        prefs::kDataReductionProxySavingsClearedNegativeSystemClock);
-    if (last_savings_cleared_time != 0) {
-      int32_t days_since_savings_cleared =
-          (clock_->Now() -
-           base::Time::FromInternalValue(last_savings_cleared_time))
-              .InDays();
-
-      // Sample in the UMA histograms must be at least 1.
-      if (days_since_savings_cleared == 0)
-        days_since_savings_cleared = 1;
-      UMA_HISTOGRAM_CUSTOM_COUNTS(
-          "DataReductionProxy.DaysSinceSavingsCleared.NegativeSystemClock",
-          days_since_savings_cleared, 1, 365, 50);
-    }
   }
 
   if (enabled &&
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
index 09b2bb1..3328eec98 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
@@ -504,28 +504,6 @@
                    prefs::kDataReductionProxyLastEnabledTime));
 }
 
-TEST_F(DataReductionProxySettingsTest, TestDaysSinceSavingsCleared) {
-  base::SimpleTestClock clock;
-  clock.Advance(base::TimeDelta::FromDays(1));
-  ResetSettings(&clock);
-
-  base::HistogramTester histogram_tester;
-  test_context_->pref_service()->SetInt64(
-      prefs::kDataReductionProxySavingsClearedNegativeSystemClock,
-      clock.Now().ToInternalValue());
-
-  test_context_->RunUntilIdle();
-
-  clock.Advance(base::TimeDelta::FromDays(100));
-
-  // Simulate Chromium startup with data reduction proxy already enabled.
-  test_context_->SetDataReductionProxyEnabled(true);
-  settings_->MaybeActivateDataReductionProxy(true /* at_startup */);
-  test_context_->RunUntilIdle();
-  histogram_tester.ExpectUniqueSample(
-      "DataReductionProxy.DaysSinceSavingsCleared.NegativeSystemClock", 100, 1);
-}
-
 TEST_F(DataReductionProxySettingsTest, TestGetDailyContentLengths) {
   ContentLengthList result =
       settings_->GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc
index 9ba22835..0b9e3a2 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc
@@ -54,11 +54,6 @@
 const char kDataReductionProxyLastEnabledTime[] =
     "data_reduction.last_enabled_time";
 
-// An integer pref that contains the time when the data reduction proxy savings
-// were last cleared because the system clock was moved back by more than 1 day.
-const char kDataReductionProxySavingsClearedNegativeSystemClock[] =
-    "data_reduction.savings_cleared_negative_system_clock";
-
 // An int64_t pref that contains the total size of all HTTP content received
 // from the network.
 const char kHttpReceivedContentLength[] = "http_received_content_length";
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h
index 57bcb3e..c07df70f 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h
@@ -21,7 +21,6 @@
 extern const char kDataUsageReportingEnabled[];
 extern const char kDataReductionProxyWasEnabledBefore[];
 extern const char kDataReductionProxyLastEnabledTime[];
-extern const char kDataReductionProxySavingsClearedNegativeSystemClock[];
 extern const char kHttpOriginalContentLength[];
 extern const char kHttpReceivedContentLength[];
 extern const char kDataReductionProxyLastConfigRetrievalTime[];
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 676c74a..777a413 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -27702,6 +27702,9 @@
 <histogram
     name="DataReductionProxy.DaysSinceSavingsCleared.NegativeSystemClock"
     units="days" expires_after="M78">
+  <obsolete>
+    Obsoleted in M-79.
+  </obsolete>
   <owner>[email protected]</owner>
   <owner>[email protected]</owner>
   <summary>