Migrate geoposition code in night light.
This is an intermediate step to migrating NightLightController to
ScheduledFeature. It removes all geo-related code from night light
and uses GeolocationController instead (which is what ScheduledFeature
uses). The internals of NightLightController more closely resemble
ScheduledFeature now.
There are no major differences between GeolocationController and night
light's geo-related code, so it can be substituted without any
behavioral changes.
Bug: b:289276024
Change-Id: I506579eb523be7ecf62fd4191317ee7b9e0848a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4886897
Reviewed-by: Ahmed Fakhry <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Commit-Queue: Eric Sum <[email protected]>
Reviewed-by: David Trainor <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1213950}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index cd1f67f..fc9188e 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -943,6 +943,13 @@
const char kSupportedLinksAppPrefsKey[] = "supported_links_infobar.apps";
#endif // BUILDFLAG(IS_CHROMEOS)
+// Deprecated 10/2023.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+constexpr char kNightLightCachedLatitude[] = "ash.night_light.cached_latitude";
+constexpr char kNightLightCachedLongitude[] =
+ "ash.night_light.cached_longitude";
+#endif
+
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1327,6 +1334,12 @@
#if BUILDFLAG(IS_CHROMEOS)
registry->RegisterDictionaryPref(kSupportedLinksAppPrefsKey);
#endif // BUILDFLAG(IS_CHROMEOS)
+
+// Deprecated 10/2023.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+ registry->RegisterDoublePref(kNightLightCachedLatitude, 0.0);
+ registry->RegisterDoublePref(kNightLightCachedLongitude, 0.0);
+#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -2494,6 +2507,12 @@
profile_prefs->ClearPref(kSupportedLinksAppPrefsKey);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+ // Added 10/2023.
+ profile_prefs->ClearPref(kNightLightCachedLatitude);
+ profile_prefs->ClearPref(kNightLightCachedLongitude);
+#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS