add-flag-to-disable-local-history-expiration.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. # Keep local history longer than 90 days
  2. --- a/chrome/browser/ungoogled_flag_entries.h
  3. +++ b/chrome/browser/ungoogled_flag_entries.h
  4. @@ -60,4 +60,8 @@
  5. "Popups to tabs",
  6. "Makes popups open in new tabs. ungoogled-chromium flag",
  7. kOsAll, SINGLE_VALUE_TYPE("popups-to-tabs")},
  8. + {"keep-old-history",
  9. + "Keep old history",
  10. + "Keep history older than 3 months. ungoogled-chromium flag",
  11. + kOsAll, SINGLE_VALUE_TYPE("keep-old-history")},
  12. #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
  13. --- a/components/history/core/browser/history_backend.cc
  14. +++ b/components/history/core/browser/history_backend.cc
  15. @@ -15,6 +15,7 @@
  16. #include <vector>
  17. #include "base/bind.h"
  18. +#include "base/command_line.h"
  19. #include "base/callback_helpers.h"
  20. #include "base/compiler_specific.h"
  21. #include "base/containers/flat_set.h"
  22. @@ -910,7 +911,8 @@ void HistoryBackend::InitImpl(
  23. db_->GetStartDate(&first_recorded_time_);
  24. // Start expiring old stuff.
  25. - expirer_.StartExpiringOldStuff(TimeDelta::FromDays(kExpireDaysThreshold));
  26. + if (!base::CommandLine::ForCurrentProcess()->HasSwitch("keep-old-history"))
  27. + expirer_.StartExpiringOldStuff(TimeDelta::FromDays(kExpireDaysThreshold));
  28. LOCAL_HISTOGRAM_TIMES("History.InitTime", TimeTicks::Now() - beginning_time);
  29. }