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

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, 8 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // locale dll to load. 670 // locale dll to load.
671 PrefService* local_state = g_browser_process->local_state(); 671 PrefService* local_state = g_browser_process->local_state();
672 DCHECK(local_state); 672 DCHECK(local_state);
673 673
674 // TODO(brettw,*): this comment about ResourceBundle was here since 674 // TODO(brettw,*): this comment about ResourceBundle was here since
675 // initial commit. This comment seems unrelated, bit-rotten and 675 // initial commit. This comment seems unrelated, bit-rotten and
676 // a candidate for removal. 676 // a candidate for removal.
677 // Initialize ResourceBundle which handles files loaded from external 677 // Initialize ResourceBundle which handles files loaded from external
678 // sources. This has to be done before uninstall code path and before prefs 678 // sources. This has to be done before uninstall code path and before prefs
679 // are registered. 679 // are registered.
680 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); 680 local_state->RegisterStringPref(prefs::kApplicationLocale,
681 std::string(),
682 true /* sync pref */);
681 #if defined(OS_CHROMEOS) 683 #if defined(OS_CHROMEOS)
682 local_state->RegisterStringPref(prefs::kOwnerLocale, std::string()); 684 local_state->RegisterStringPref(prefs::kOwnerLocale,
685 std::string(),
686 false /* don't sync pref */);
683 local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout, 687 local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout,
684 std::string()); 688 std::string(),
689 false /* don't sync pref */);
685 #endif // defined(OS_CHROMEOS) 690 #endif // defined(OS_CHROMEOS)
686 #if !defined(OS_CHROMEOS) 691 #if !defined(OS_CHROMEOS)
687 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, 692 local_state->RegisterBooleanPref(
688 GoogleUpdateSettings::GetCollectStatsConsent()); 693 prefs::kMetricsReportingEnabled,
694 GoogleUpdateSettings::GetCollectStatsConsent(),
695 false /* don't sync pref */);
689 #endif // !defined(OS_CHROMEOS) 696 #endif // !defined(OS_CHROMEOS)
690 697
691 if (is_first_run) { 698 if (is_first_run) {
692 #if defined(OS_WIN) 699 #if defined(OS_WIN)
693 // During first run we read the google_update registry key to find what 700 // During first run we read the google_update registry key to find what
694 // language the user selected when downloading the installer. This 701 // language the user selected when downloading the installer. This
695 // becomes our default language in the prefs. 702 // becomes our default language in the prefs.
696 // Other platforms obey the system locale. 703 // Other platforms obey the system locale.
697 std::wstring install_lang; 704 std::wstring install_lang;
698 if (GoogleUpdateSettings::GetLanguage(&install_lang)) { 705 if (GoogleUpdateSettings::GetLanguage(&install_lang)) {
(...skipping 11 matching lines...) Expand all
710 // since the parent profile command line flag can be present even when the 717 // since the parent profile command line flag can be present even when the
711 // current profile is not a new one, and in that case we do not want to 718 // current profile is not a new one, and in that case we do not want to
712 // inherit and reset the user's setting. 719 // inherit and reset the user's setting.
713 if (!local_state_file_exists && 720 if (!local_state_file_exists &&
714 parsed_command_line.HasSwitch(switches::kParentProfile)) { 721 parsed_command_line.HasSwitch(switches::kParentProfile)) {
715 FilePath parent_profile = 722 FilePath parent_profile =
716 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); 723 parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
717 scoped_ptr<PrefService> parent_local_state( 724 scoped_ptr<PrefService> parent_local_state(
718 PrefService::CreatePrefService(parent_profile, NULL, NULL)); 725 PrefService::CreatePrefService(parent_profile, NULL, NULL));
719 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, 726 parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
720 std::string()); 727 std::string(),
728 true /* sync pref */);
721 // Right now, we only inherit the locale setting from the parent profile. 729 // Right now, we only inherit the locale setting from the parent profile.
722 local_state->SetString( 730 local_state->SetString(
723 prefs::kApplicationLocale, 731 prefs::kApplicationLocale,
724 parent_local_state->GetString(prefs::kApplicationLocale)); 732 parent_local_state->GetString(prefs::kApplicationLocale));
725 } 733 }
726 734
727 #if defined(OS_CHROMEOS) 735 #if defined(OS_CHROMEOS)
728 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { 736 if (parsed_command_line.HasSwitch(switches::kLoginManager)) {
729 std::string owner_locale = local_state->GetString(prefs::kOwnerLocale); 737 std::string owner_locale = local_state->GetString(prefs::kOwnerLocale);
730 // Ensure that we start with owner's locale. 738 // Ensure that we start with owner's locale.
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 #if defined(OS_CHROMEOS) 1896 #if defined(OS_CHROMEOS)
1889 // To be precise, logout (browser shutdown) is not yet done, but the 1897 // To be precise, logout (browser shutdown) is not yet done, but the
1890 // remaining work is negligible, hence we say LogoutDone here. 1898 // remaining work is negligible, hence we say LogoutDone here.
1891 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 1899 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1892 false); 1900 false);
1893 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 1901 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1894 #endif 1902 #endif
1895 TRACE_EVENT_END("BrowserMain", 0, 0); 1903 TRACE_EVENT_END("BrowserMain", 0, 0);
1896 return result_code; 1904 return result_code;
1897 } 1905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698