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

Side by Side Diff: chrome/browser/browser_main.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 // locale dll to load. 671 // locale dll to load.
672 PrefService* local_state = g_browser_process->local_state(); 672 PrefService* local_state = g_browser_process->local_state();
673 DCHECK(local_state); 673 DCHECK(local_state);
674 674
675 // TODO(brettw,*): this comment about ResourceBundle was here since 675 // TODO(brettw,*): this comment about ResourceBundle was here since
676 // initial commit. This comment seems unrelated, bit-rotten and 676 // initial commit. This comment seems unrelated, bit-rotten and
677 // a candidate for removal. 677 // a candidate for removal.
678 // Initialize ResourceBundle which handles files loaded from external 678 // Initialize ResourceBundle which handles files loaded from external
679 // sources. This has to be done before uninstall code path and before prefs 679 // sources. This has to be done before uninstall code path and before prefs
680 // are registered. 680 // are registered.
681 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); 681 local_state->RegisterStringPref(prefs::kApplicationLocale,
682 std::string(),
683 true /* sync pref */);
682 #if defined(OS_CHROMEOS) 684 #if defined(OS_CHROMEOS)
683 local_state->RegisterStringPref(prefs::kOwnerLocale, std::string()); 685 local_state->RegisterStringPref(prefs::kOwnerLocale,
686 std::string(),
687 false /* don't sync pref */);
684 local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout, 688 local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout,
685 std::string()); 689 std::string(),
690 false /* don't sync pref */);
686 #endif // defined(OS_CHROMEOS) 691 #endif // defined(OS_CHROMEOS)
687 #if !defined(OS_CHROMEOS) 692 #if !defined(OS_CHROMEOS)
688 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, 693 local_state->RegisterBooleanPref(
689 GoogleUpdateSettings::GetCollectStatsConsent()); 694 prefs::kMetricsReportingEnabled,
695 GoogleUpdateSettings::GetCollectStatsConsent(),
696 false /* don't sync pref */);
690 #endif // !defined(OS_CHROMEOS) 697 #endif // !defined(OS_CHROMEOS)
691 698
692 if (is_first_run) { 699 if (is_first_run) {
693 #if defined(OS_WIN) 700 #if defined(OS_WIN)
694 // During first run we read the google_update registry key to find what 701 // During first run we read the google_update registry key to find what
695 // language the user selected when downloading the installer. This 702 // language the user selected when downloading the installer. This
696 // becomes our default language in the prefs. 703 // becomes our default language in the prefs.
697 // Other platforms obey the system locale. 704 // Other platforms obey the system locale.
698 std::wstring install_lang; 705 std::wstring install_lang;
699 if (GoogleUpdateSettings::GetLanguage(&install_lang)) { 706 if (GoogleUpdateSettings::GetLanguage(&install_lang)) {
(...skipping 11 matching lines...) Expand all
711 // since the parent profile command line flag can be present even when the 718 // since the parent profile command line flag can be present even when the
712 // current profile is not a new one, and in that case we do not want to 719 // current profile is not a new one, and in that case we do not want to
713 // inherit and reset the user's setting. 720 // inherit and reset the user's setting.
714 if (!local_state_file_exists && 721 if (!local_state_file_exists &&
715 parsed_command_line.HasSwitch(switches::kParentProfile)) { 722 parsed_command_line.HasSwitch(switches::kParentProfile)) {
716 FilePath parent_profile = 723 FilePath parent_profile =
717 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); 724 parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
718 scoped_ptr<PrefService> parent_local_state( 725 scoped_ptr<PrefService> parent_local_state(
719 PrefService::CreatePrefService(parent_profile, NULL, NULL)); 726 PrefService::CreatePrefService(parent_profile, NULL, NULL));
720 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, 727 parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
721 std::string()); 728 std::string(),
729 true /* sync pref */);
722 // Right now, we only inherit the locale setting from the parent profile. 730 // Right now, we only inherit the locale setting from the parent profile.
723 local_state->SetString( 731 local_state->SetString(
724 prefs::kApplicationLocale, 732 prefs::kApplicationLocale,
725 parent_local_state->GetString(prefs::kApplicationLocale)); 733 parent_local_state->GetString(prefs::kApplicationLocale));
726 } 734 }
727 735
728 #if defined(OS_CHROMEOS) 736 #if defined(OS_CHROMEOS)
729 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { 737 if (parsed_command_line.HasSwitch(switches::kLoginManager)) {
730 std::string owner_locale = local_state->GetString(prefs::kOwnerLocale); 738 std::string owner_locale = local_state->GetString(prefs::kOwnerLocale);
731 // Ensure that we start with owner's locale. 739 // Ensure that we start with owner's locale.
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 #if defined(OS_CHROMEOS) 1906 #if defined(OS_CHROMEOS)
1899 // To be precise, logout (browser shutdown) is not yet done, but the 1907 // To be precise, logout (browser shutdown) is not yet done, but the
1900 // remaining work is negligible, hence we say LogoutDone here. 1908 // remaining work is negligible, hence we say LogoutDone here.
1901 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 1909 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1902 false); 1910 false);
1903 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 1911 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1904 #endif 1912 #endif
1905 TRACE_EVENT_END("BrowserMain", 0, 0); 1913 TRACE_EVENT_END("BrowserMain", 0, 0);
1906 return result_code; 1914 return result_code;
1907 } 1915 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698