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

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: Rebase + comments 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 // locale dll to load. 738 // locale dll to load.
739 PrefService* local_state = g_browser_process->local_state(); 739 PrefService* local_state = g_browser_process->local_state();
740 DCHECK(local_state); 740 DCHECK(local_state);
741 741
742 // TODO(brettw,*): this comment about ResourceBundle was here since 742 // TODO(brettw,*): this comment about ResourceBundle was here since
743 // initial commit. This comment seems unrelated, bit-rotten and 743 // initial commit. This comment seems unrelated, bit-rotten and
744 // a candidate for removal. 744 // a candidate for removal.
745 // Initialize ResourceBundle which handles files loaded from external 745 // Initialize ResourceBundle which handles files loaded from external
746 // sources. This has to be done before uninstall code path and before prefs 746 // sources. This has to be done before uninstall code path and before prefs
747 // are registered. 747 // are registered.
748 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); 748 local_state->RegisterStringPref(prefs::kApplicationLocale,
749 std::string(),
750 true /* sync pref */);
749 #if defined(OS_CHROMEOS) 751 #if defined(OS_CHROMEOS)
750 local_state->RegisterStringPref(prefs::kOwnerLocale, std::string()); 752 local_state->RegisterStringPref(prefs::kOwnerLocale,
753 std::string(),
754 false /* don't sync pref */);
751 local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout, 755 local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout,
752 std::string()); 756 std::string(),
757 false /* don't sync pref */);
753 #endif // defined(OS_CHROMEOS) 758 #endif // defined(OS_CHROMEOS)
754 #if !defined(OS_CHROMEOS) 759 #if !defined(OS_CHROMEOS)
755 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, 760 local_state->RegisterBooleanPref(
756 GoogleUpdateSettings::GetCollectStatsConsent()); 761 prefs::kMetricsReportingEnabled,
762 GoogleUpdateSettings::GetCollectStatsConsent(),
763 false /* don't sync pref */);
757 #endif // !defined(OS_CHROMEOS) 764 #endif // !defined(OS_CHROMEOS)
758 765
759 if (is_first_run) { 766 if (is_first_run) {
760 #if defined(OS_WIN) 767 #if defined(OS_WIN)
761 // During first run we read the google_update registry key to find what 768 // During first run we read the google_update registry key to find what
762 // language the user selected when downloading the installer. This 769 // language the user selected when downloading the installer. This
763 // becomes our default language in the prefs. 770 // becomes our default language in the prefs.
764 // Other platforms obey the system locale. 771 // Other platforms obey the system locale.
765 std::wstring install_lang; 772 std::wstring install_lang;
766 if (GoogleUpdateSettings::GetLanguage(&install_lang)) { 773 if (GoogleUpdateSettings::GetLanguage(&install_lang)) {
(...skipping 11 matching lines...) Expand all
778 // since the parent profile command line flag can be present even when the 785 // since the parent profile command line flag can be present even when the
779 // current profile is not a new one, and in that case we do not want to 786 // current profile is not a new one, and in that case we do not want to
780 // inherit and reset the user's setting. 787 // inherit and reset the user's setting.
781 if (!local_state_file_exists && 788 if (!local_state_file_exists &&
782 parsed_command_line.HasSwitch(switches::kParentProfile)) { 789 parsed_command_line.HasSwitch(switches::kParentProfile)) {
783 FilePath parent_profile = 790 FilePath parent_profile =
784 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); 791 parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
785 scoped_ptr<PrefService> parent_local_state( 792 scoped_ptr<PrefService> parent_local_state(
786 PrefService::CreatePrefService(parent_profile, NULL, NULL)); 793 PrefService::CreatePrefService(parent_profile, NULL, NULL));
787 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, 794 parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
788 std::string()); 795 std::string(),
796 true /* sync pref */);
789 // Right now, we only inherit the locale setting from the parent profile. 797 // Right now, we only inherit the locale setting from the parent profile.
790 local_state->SetString( 798 local_state->SetString(
791 prefs::kApplicationLocale, 799 prefs::kApplicationLocale,
792 parent_local_state->GetString(prefs::kApplicationLocale)); 800 parent_local_state->GetString(prefs::kApplicationLocale));
793 } 801 }
794 802
795 #if defined(OS_CHROMEOS) 803 #if defined(OS_CHROMEOS)
796 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { 804 if (parsed_command_line.HasSwitch(switches::kLoginManager)) {
797 std::string owner_locale = local_state->GetString(prefs::kOwnerLocale); 805 std::string owner_locale = local_state->GetString(prefs::kOwnerLocale);
798 // Ensure that we start with owner's locale. 806 // Ensure that we start with owner's locale.
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 #if defined(OS_CHROMEOS) 1932 #if defined(OS_CHROMEOS)
1925 // To be precise, logout (browser shutdown) is not yet done, but the 1933 // To be precise, logout (browser shutdown) is not yet done, but the
1926 // remaining work is negligible, hence we say LogoutDone here. 1934 // remaining work is negligible, hence we say LogoutDone here.
1927 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 1935 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1928 false); 1936 false);
1929 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 1937 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1930 #endif 1938 #endif
1931 TRACE_EVENT_END("BrowserMain", 0, 0); 1939 TRACE_EVENT_END("BrowserMain", 0, 0);
1932 return result_code; 1940 return result_code;
1933 } 1941 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698