Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: chrome/browser/prefs/browser_prefs.cc

Issue 2714853002: Remove kDistroDict from Preferences. (Closed)
Patch Set: Format and hide constant behind flag too Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prefs/browser_prefs.h" 5 #include "chrome/browser/prefs/browser_prefs.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #include "components/translate/core/browser/language_model.h" 105 #include "components/translate/core/browser/language_model.h"
106 #include "components/translate/core/browser/translate_prefs.h" 106 #include "components/translate/core/browser/translate_prefs.h"
107 #include "components/update_client/update_client.h" 107 #include "components/update_client/update_client.h"
108 #include "components/variations/service/variations_service.h" 108 #include "components/variations/service/variations_service.h"
109 #include "content/public/browser/browser_thread.h" 109 #include "content/public/browser/browser_thread.h"
110 #include "content/public/browser/render_process_host.h" 110 #include "content/public/browser/render_process_host.h"
111 #include "extensions/features/features.h" 111 #include "extensions/features/features.h"
112 #include "net/http/http_server_properties_manager.h" 112 #include "net/http/http_server_properties_manager.h"
113 #include "ppapi/features/features.h" 113 #include "ppapi/features/features.h"
114 #include "printing/features/features.h" 114 #include "printing/features/features.h"
115 #include "rlz/features/features.h"
115 116
116 #if BUILDFLAG(ENABLE_APP_LIST) 117 #if BUILDFLAG(ENABLE_APP_LIST)
117 #include "chrome/browser/apps/drive/drive_app_mapping.h" 118 #include "chrome/browser/apps/drive/drive_app_mapping.h"
118 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 119 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
119 #endif 120 #endif
120 121
121 #if BUILDFLAG(ENABLE_BACKGROUND) 122 #if BUILDFLAG(ENABLE_BACKGROUND)
122 #include "chrome/browser/background/background_mode_manager.h" 123 #include "chrome/browser/background/background_mode_manager.h"
123 #endif 124 #endif
124 125
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #endif 256 #endif
256 257
257 #if !defined(OS_ANDROID) && !defined(OS_IOS) 258 #if !defined(OS_ANDROID) && !defined(OS_IOS)
258 #include "chrome/browser/ui/webui/md_history_ui.h" 259 #include "chrome/browser/ui/webui/md_history_ui.h"
259 #endif 260 #endif
260 261
261 namespace { 262 namespace {
262 263
263 #if BUILDFLAG(ENABLE_GOOGLE_NOW) 264 #if BUILDFLAG(ENABLE_GOOGLE_NOW)
264 // Deprecated 3/2016 265 // Deprecated 3/2016
265 const char kGoogleGeolocationAccessEnabled[] = 266 constexpr char kGoogleGeolocationAccessEnabled[] =
266 "googlegeolocationaccess.enabled"; 267 "googlegeolocationaccess.enabled";
267 #endif 268 #endif
268 269
269 // Deprecated 4/2016. 270 // Deprecated 4/2016.
270 const char kCheckDefaultBrowser[] = "browser.check_default_browser"; 271 constexpr char kCheckDefaultBrowser[] = "browser.check_default_browser";
271 272
272 // Deprecated 5/2016. 273 // Deprecated 5/2016.
273 const char kDesktopSearchRedirectionInfobarShownPref[] = 274 constexpr char kDesktopSearchRedirectionInfobarShownPref[] =
274 "desktop_search_redirection_infobar_shown"; 275 "desktop_search_redirection_infobar_shown";
275 276
276 // Deprecated 7/2016. 277 // Deprecated 7/2016.
277 const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled"; 278 constexpr char kNetworkPredictionEnabled[] = "dns_prefetching.enabled";
278 const char kDisableSpdy[] = "spdy.disabled"; 279 constexpr char kDisableSpdy[] = "spdy.disabled";
279 280
280 // Deprecated 8/2016. 281 // Deprecated 8/2016.
281 const char kRecentlySelectedEncoding[] = "profile.recently_selected_encodings"; 282 constexpr char kRecentlySelectedEncoding[] =
282 const char kStaticEncodings[] = "intl.static_encodings"; 283 "profile.recently_selected_encodings";
284 constexpr char kStaticEncodings[] = "intl.static_encodings";
283 285
284 // Deprecated 9/2016. 286 // Deprecated 9/2016.
285 const char kWebKitUsesUniversalDetector[] = 287 constexpr char kWebKitUsesUniversalDetector[] =
286 "webkit.webprefs.uses_universal_detector"; 288 "webkit.webprefs.uses_universal_detector";
287 const char kWebKitAllowDisplayingInsecureContent[] = 289 constexpr char kWebKitAllowDisplayingInsecureContent[] =
288 "webkit.webprefs.allow_displaying_insecure_content"; 290 "webkit.webprefs.allow_displaying_insecure_content";
289 291
290 #if BUILDFLAG(ENABLE_EXTENSIONS) 292 #if BUILDFLAG(ENABLE_EXTENSIONS)
291 // Deprecated 2/2017. 293 // Deprecated 2/2017.
292 const char kToolbarMigratedComponentActionStatus[] = 294 constexpr char kToolbarMigratedComponentActionStatus[] =
293 "toolbar_migrated_component_action_status"; 295 "toolbar_migrated_component_action_status";
294 #endif 296 #endif
295 297
298 #if BUILDFLAG(ENABLE_RLZ)
299 // Migrated out of kDistroDict as of 2/2017.
300 constexpr char kDistroRlzPingDelay[] = "ping_delay";
301 #endif // BUILDFLAG(ENABLE_RLZ)
302
303 // master_preferences used to be mapped as-is to Preferences on first run but
304 // the "distribution" dictionary was never used beyond first run. It is now
305 // stripped in first_run.cc prior to applying this mapping. Cleanup for existing
306 // Preferences files added here 2/2017.
307 constexpr char kDistroDict[] = "distribution";
308
296 void DeleteWebRTCIdentityStoreDBOnFileThread( 309 void DeleteWebRTCIdentityStoreDBOnFileThread(
297 const base::FilePath& profile_path) { 310 const base::FilePath& profile_path) {
298 base::DeleteFile(profile_path.Append( 311 base::DeleteFile(profile_path.Append(
299 FILE_PATH_LITERAL("WebRTCIdentityStore")), false); 312 FILE_PATH_LITERAL("WebRTCIdentityStore")), false);
300 base::DeleteFile(profile_path.Append( 313 base::DeleteFile(profile_path.Append(
301 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false); 314 FILE_PATH_LITERAL("WebRTCIdentityStore-journal")), false);
302 } 315 }
303 316
304 void DeleteWebRTCIdentityStoreDB(const Profile& profile) { 317 void DeleteWebRTCIdentityStoreDB(const Profile& profile) {
305 content::BrowserThread::PostDelayedTask( 318 content::BrowserThread::PostDelayedTask(
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 registry->RegisterBooleanPref(kDisableSpdy, false); 646 registry->RegisterBooleanPref(kDisableSpdy, false);
634 registry->RegisterStringPref(kStaticEncodings, std::string()); 647 registry->RegisterStringPref(kStaticEncodings, std::string());
635 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string()); 648 registry->RegisterStringPref(kRecentlySelectedEncoding, std::string());
636 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true); 649 registry->RegisterBooleanPref(kWebKitUsesUniversalDetector, true);
637 650
638 registry->RegisterBooleanPref(kWebKitAllowDisplayingInsecureContent, true); 651 registry->RegisterBooleanPref(kWebKitAllowDisplayingInsecureContent, true);
639 652
640 #if BUILDFLAG(ENABLE_EXTENSIONS) 653 #if BUILDFLAG(ENABLE_EXTENSIONS)
641 registry->RegisterDictionaryPref(kToolbarMigratedComponentActionStatus); 654 registry->RegisterDictionaryPref(kToolbarMigratedComponentActionStatus);
642 #endif 655 #endif
656
657 registry->RegisterDictionaryPref(kDistroDict);
643 } 658 }
644 659
645 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 660 void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
646 RegisterProfilePrefs(registry); 661 RegisterProfilePrefs(registry);
647 662
648 #if defined(OS_CHROMEOS) 663 #if defined(OS_CHROMEOS)
649 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry); 664 chromeos::PowerPrefs::RegisterUserProfilePrefs(registry);
650 #endif 665 #endif
651 666
652 #if defined(OS_ANDROID) 667 #if defined(OS_ANDROID)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 profile_prefs->ClearPref(kRecentlySelectedEncoding); 740 profile_prefs->ClearPref(kRecentlySelectedEncoding);
726 741
727 // Added 9/2016. 742 // Added 9/2016.
728 profile_prefs->ClearPref(kWebKitUsesUniversalDetector); 743 profile_prefs->ClearPref(kWebKitUsesUniversalDetector);
729 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent); 744 profile_prefs->ClearPref(kWebKitAllowDisplayingInsecureContent);
730 745
731 #if BUILDFLAG(ENABLE_EXTENSIONS) 746 #if BUILDFLAG(ENABLE_EXTENSIONS)
732 // Added 2/2017. 747 // Added 2/2017.
733 profile_prefs->ClearPref(kToolbarMigratedComponentActionStatus); 748 profile_prefs->ClearPref(kToolbarMigratedComponentActionStatus);
734 #endif 749 #endif
750
751 // Added 2/2017.
752 {
753 #if BUILDFLAG(ENABLE_RLZ)
grt (UTC plus 2) 2017/02/24 07:42:21 i'm not convinced that the pref should not be migr
Roger Tawa OOO till Jul 10th 2017/02/24 16:02:17 What is the chance of that? It's like saying we a
gab 2017/02/28 19:54:45 Agreed that we shouldn't worry about shipping a no
grt (UTC plus 2) 2017/02/28 20:09:07 It is destructive -- kDistroDict is cleared on lin
gab 2017/02/28 22:30:41 Ah right but what you're describing is caused by c
754 const base::DictionaryValue* distro_dict =
755 profile_prefs->GetDictionary(kDistroDict);
756 int rlz_ping_delay = 0;
757 if (distro_dict &&
758 distro_dict->GetInteger(kDistroRlzPingDelay, &rlz_ping_delay)) {
759 profile_prefs->SetInteger(prefs::kRlzPingDelay, rlz_ping_delay);
760 }
761 #endif // BUILDFLAG(ENABLE_RLZ)
762 profile_prefs->ClearPref(kDistroDict);
763 }
735 } 764 }
736 765
737 } // namespace chrome 766 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698