add-flag-to-disable-local-history-expiration.patch 1.87 KB
Newer Older
1 2
# Keep local history longer than 90 days

3
Index: chromium-128.0.6613.137/chrome/browser/ungoogled_flag_entries.h
4
===================================================================
5 6
--- chromium-128.0.6613.137.orig/chrome/browser/ungoogled_flag_entries.h
+++ chromium-128.0.6613.137/chrome/browser/ungoogled_flag_entries.h
7 8 9 10 11 12 13 14 15
@@ -52,4 +52,8 @@
      "Popups to tabs",
      "Makes popups open in new tabs. ungoogled-chromium flag",
      kOsAll, SINGLE_VALUE_TYPE("popups-to-tabs")},
+    {"keep-old-history",
+     "Keep old history",
+     "Keep history older than 3 months. ungoogled-chromium flag",
+     kOsAll, SINGLE_VALUE_TYPE("keep-old-history")},
 #endif  // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
16
Index: chromium-128.0.6613.137/components/history/core/browser/history_backend.cc
17
===================================================================
18 19
--- chromium-128.0.6613.137.orig/components/history/core/browser/history_backend.cc
+++ chromium-128.0.6613.137/components/history/core/browser/history_backend.cc
20 21 22 23 24 25 26 27
@@ -14,6 +14,7 @@
 #include <utility>
 #include <vector>
 
+#include "base/command_line.h"
 #include "base/compiler_specific.h"
 #include "base/containers/flat_set.h"
 #include "base/feature_list.h"
28
@@ -1320,7 +1321,8 @@ void HistoryBackend::InitImpl(
29 30 31 32 33 34 35 36 37
   db_->GetStartDate(&first_recorded_time_);
 
   // Start expiring old stuff.
-  expirer_.StartExpiringOldStuff(base::Days(kExpireDaysThreshold));
+  if (!base::CommandLine::ForCurrentProcess()->HasSwitch("keep-old-history"))
+    expirer_.StartExpiringOldStuff(base::Days(kExpireDaysThreshold));
 }
 
 void HistoryBackend::OnMemoryPressure(
38
@@ -1548,6 +1550,8 @@ void HistoryBackend::AddPagesWithDetails
39 40 41 42 43 44 45 46
 }
 
 bool HistoryBackend::IsExpiredVisitTime(const base::Time& time) const {
+  if (base::CommandLine::ForCurrentProcess()->HasSwitch("keep-old-history"))
+    return false;
   return time < expirer_.GetCurrentExpirationTime();
 }