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/chromeos/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/autoclick/autoclick_controller.h" | 9 #include "ash/autoclick/autoclick_controller.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 21 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
22 #include "chrome/browser/chromeos/drive/file_system_util.h" | 22 #include "chrome/browser/chromeos/drive/file_system_util.h" |
23 #include "chrome/browser/chromeos/input_method/input_method_syncer.h" | 23 #include "chrome/browser/chromeos/input_method/input_method_syncer.h" |
24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
25 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" | 25 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
26 #include "chrome/browser/chromeos/system/input_device_settings.h" | 26 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 27 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" |
27 #include "chrome/browser/download/download_prefs.h" | 28 #include "chrome/browser/download/download_prefs.h" |
28 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 29 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
29 #include "chrome/common/chrome_features.h" | 30 #include "chrome/common/chrome_features.h" |
30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
31 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
32 #include "chromeos/system/statistics_provider.h" | 33 #include "chromeos/system/statistics_provider.h" |
33 #include "chromeos/timezone/timezone_resolver.h" | 34 #include "chromeos/timezone/timezone_resolver.h" |
34 #include "components/drive/drive_pref_names.h" | 35 #include "components/drive/drive_pref_names.h" |
35 #include "components/feedback/tracing_manager.h" | 36 #include "components/feedback/tracing_manager.h" |
36 #include "components/pref_registry/pref_registry_syncable.h" | 37 #include "components/pref_registry/pref_registry_syncable.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 } | 634 } |
634 | 635 |
635 if (pref_name == prefs::kResolveTimezoneByGeolocation && | 636 if (pref_name == prefs::kResolveTimezoneByGeolocation && |
636 reason != REASON_ACTIVE_USER_CHANGED) { | 637 reason != REASON_ACTIVE_USER_CHANGED) { |
637 const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation); | 638 const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation); |
638 if (user_is_owner) { | 639 if (user_is_owner) { |
639 g_browser_process->local_state()->SetBoolean( | 640 g_browser_process->local_state()->SetBoolean( |
640 prefs::kResolveDeviceTimezoneByGeolocation, value); | 641 prefs::kResolveDeviceTimezoneByGeolocation, value); |
641 } | 642 } |
642 if (user_is_primary_) { | 643 if (user_is_primary_) { |
643 if (value) { | 644 system::TimeZoneResolverManager* manager = |
644 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); | 645 g_browser_process->platform_part()->GetTimezoneResolverManager(); |
645 } else { | 646 manager->SetPrimaryUserPrefs(prefs_); |
646 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); | 647 manager->UpdateTimezoneResolver(); |
647 if (reason == REASON_PREF_CHANGED) { | 648 if (!value && reason == REASON_PREF_CHANGED) { |
648 // Allow immediate timezone update on Stop + Start. | 649 // Allow immediate timezone update on Stop + Start. |
649 g_browser_process->local_state()->ClearPref( | 650 g_browser_process->local_state()->ClearPref( |
650 TimeZoneResolver::kLastTimeZoneRefreshTime); | 651 TimeZoneResolver::kLastTimeZoneRefreshTime); |
651 } | |
652 } | 652 } |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 if (pref_name == prefs::kUse24HourClock || | 656 if (pref_name == prefs::kUse24HourClock || |
657 reason != REASON_ACTIVE_USER_CHANGED) { | 657 reason != REASON_ACTIVE_USER_CHANGED) { |
658 const bool value = prefs_->GetBoolean(prefs::kUse24HourClock); | 658 const bool value = prefs_->GetBoolean(prefs::kUse24HourClock); |
659 user_manager::known_user::SetBooleanPref(user_->GetAccountId(), | 659 user_manager::known_user::SetBooleanPref(user_->GetAccountId(), |
660 prefs::kUse24HourClock, value); | 660 prefs::kUse24HourClock, value); |
661 } | 661 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 touch_hud_projection_enabled_.SetValue(enabled); | 745 touch_hud_projection_enabled_.SetValue(enabled); |
746 } | 746 } |
747 | 747 |
748 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { | 748 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { |
749 if (active_user != user_) | 749 if (active_user != user_) |
750 return; | 750 return; |
751 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); | 751 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); |
752 } | 752 } |
753 | 753 |
754 } // namespace chromeos | 754 } // namespace chromeos |
OLD | NEW |