Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/debug/stack_trace.h" | |
|
sail
2013/09/09 22:02:17
don't need?
| |
| 11 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 12 #include "base/environment.h" | 13 #include "base/environment.h" |
| 13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 17 #include "base/prefs/json_pref_store.h" | 18 #include "base/prefs/json_pref_store.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
| 23 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
| 24 #include "base/version.h" | 25 #include "base/version.h" |
| 25 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 26 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 26 #include "chrome/browser/background/background_contents_service_factory.h" | 27 #include "chrome/browser/background/background_contents_service_factory.h" |
| 27 #include "chrome/browser/background/background_mode_manager.h" | 28 #include "chrome/browser/background/background_mode_manager.h" |
| 28 #include "chrome/browser/bookmarks/bookmark_model.h" | 29 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 29 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 30 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 30 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 31 #include "chrome/browser/chrome_notification_types.h" | 32 #include "chrome/browser/chrome_notification_types.h" |
| 33 #include "chrome/browser/chromeos/login/language_switch_menu.h" | |
|
sail
2013/09/09 22:02:17
don't need?
| |
| 32 #include "chrome/browser/content_settings/cookie_settings.h" | 34 #include "chrome/browser/content_settings/cookie_settings.h" |
| 33 #include "chrome/browser/content_settings/host_content_settings_map.h" | 35 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 34 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 36 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 35 #include "chrome/browser/download/download_service.h" | 37 #include "chrome/browser/download/download_service.h" |
| 36 #include "chrome/browser/download/download_service_factory.h" | 38 #include "chrome/browser/download/download_service_factory.h" |
| 37 #include "chrome/browser/extensions/extension_pref_store.h" | 39 #include "chrome/browser/extensions/extension_pref_store.h" |
| 38 #include "chrome/browser/extensions/extension_pref_value_map.h" | 40 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 39 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" | 41 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" |
| 40 #include "chrome/browser/extensions/extension_service.h" | 42 #include "chrome/browser/extensions/extension_service.h" |
| 41 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 43 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 if (locale_change_guard_ == NULL) | 1033 if (locale_change_guard_ == NULL) |
| 1032 locale_change_guard_.reset(new chromeos::LocaleChangeGuard(this)); | 1034 locale_change_guard_.reset(new chromeos::LocaleChangeGuard(this)); |
| 1033 locale_change_guard_->PrepareChangingLocale(cur_locale, new_locale); | 1035 locale_change_guard_->PrepareChangingLocale(cur_locale, new_locale); |
| 1034 } | 1036 } |
| 1035 } else { | 1037 } else { |
| 1036 std::string cur_locale = g_browser_process->GetApplicationLocale(); | 1038 std::string cur_locale = g_browser_process->GetApplicationLocale(); |
| 1037 std::string backup_locale = | 1039 std::string backup_locale = |
| 1038 GetPrefs()->GetString(prefs::kApplicationLocaleBackup); | 1040 GetPrefs()->GetString(prefs::kApplicationLocaleBackup); |
| 1039 // Profile synchronization takes time and is not completed at that | 1041 // Profile synchronization takes time and is not completed at that |
| 1040 // moment at first login. So we initialize locale preference in steps: | 1042 // moment at first login. So we initialize locale preference in steps: |
| 1041 // (1) first save it to temporary backup; | 1043 // (1) first save it to temporary backup; |
|
sail
2013/09/09 22:02:17
is this comment still valid?
Alexander Alekseev
2013/09/11 18:53:02
I think so, as kApplicationLocale is not priority
| |
| 1042 // (2) on next login we assume that synchronization is already completed | 1044 // (2) on next login we assume that synchronization is already completed |
| 1043 // and we may finalize initialization. | 1045 // and we may finalize initialization. |
| 1044 GetPrefs()->SetString(prefs::kApplicationLocaleBackup, cur_locale); | 1046 GetPrefs()->SetString(prefs::kApplicationLocaleBackup, cur_locale); |
| 1045 if (!backup_locale.empty()) | 1047 if (!new_locale.empty()) |
| 1048 GetPrefs()->SetString(prefs::kApplicationLocale, new_locale); | |
| 1049 else if (!backup_locale.empty()) | |
| 1046 GetPrefs()->SetString(prefs::kApplicationLocale, backup_locale); | 1050 GetPrefs()->SetString(prefs::kApplicationLocale, backup_locale); |
| 1047 do_update_pref = false; | 1051 do_update_pref = false; |
| 1048 } | 1052 } |
| 1049 break; | 1053 break; |
| 1050 } | 1054 } |
| 1051 case APP_LOCALE_CHANGED_VIA_UNKNOWN: | 1055 case APP_LOCALE_CHANGED_VIA_UNKNOWN: |
| 1052 default: { | 1056 default: { |
| 1053 NOTREACHED(); | 1057 NOTREACHED(); |
| 1054 break; | 1058 break; |
| 1055 } | 1059 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1175 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1179 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
| 1176 #if defined(OS_CHROMEOS) | 1180 #if defined(OS_CHROMEOS) |
| 1177 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1181 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 1178 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1182 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 1179 g_browser_process->local_state()); | 1183 g_browser_process->local_state()); |
| 1180 } | 1184 } |
| 1181 #endif // defined(OS_CHROMEOS) | 1185 #endif // defined(OS_CHROMEOS) |
| 1182 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1186 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 1183 GetPrefs(), g_browser_process->local_state()); | 1187 GetPrefs(), g_browser_process->local_state()); |
| 1184 } | 1188 } |
| OLD | NEW |