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

Side by Side Diff: chrome/browser/chromeos/preferences.cc

Issue 1849133006: Revert "ChromeOS: Add SystemTimezoneAutomaticDetection policy." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
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/policy/proto/chrome_device_policy.pb.h"
27 #include "chrome/browser/chromeos/system/input_device_settings.h" 26 #include "chrome/browser/chromeos/system/input_device_settings.h"
28 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" 27 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
29 #include "chrome/browser/download/download_prefs.h" 28 #include "chrome/browser/download/download_prefs.h"
30 #include "chrome/browser/prefs/pref_service_syncable_util.h" 29 #include "chrome/browser/prefs/pref_service_syncable_util.h"
31 #include "chrome/common/chrome_features.h" 30 #include "chrome/common/chrome_features.h"
32 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
33 #include "chromeos/chromeos_switches.h" 32 #include "chromeos/chromeos_switches.h"
34 #include "chromeos/system/statistics_provider.h" 33 #include "chromeos/system/statistics_provider.h"
35 #include "chromeos/timezone/timezone_resolver.h" 34 #include "chromeos/timezone/timezone_resolver.h"
36 #include "components/drive/drive_pref_names.h" 35 #include "components/drive/drive_pref_names.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 89
91 // static 90 // static
92 void Preferences::RegisterPrefs(PrefRegistrySimple* registry) { 91 void Preferences::RegisterPrefs(PrefRegistrySimple* registry) {
93 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); 92 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
94 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); 93 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true);
95 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled, 94 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled,
96 false); 95 false);
97 registry->RegisterStringPref(prefs::kLogoutStartedLast, std::string()); 96 registry->RegisterStringPref(prefs::kLogoutStartedLast, std::string());
98 registry->RegisterBooleanPref(prefs::kResolveDeviceTimezoneByGeolocation, 97 registry->RegisterBooleanPref(prefs::kResolveDeviceTimezoneByGeolocation,
99 true); 98 true);
100 registry->RegisterIntegerPref(
101 prefs::kSystemTimezoneAutomaticDetectionPolicy,
102 enterprise_management::SystemTimezoneProto::USERS_DECIDE);
103 } 99 }
104 100
105 // static 101 // static
106 void Preferences::RegisterProfilePrefs( 102 void Preferences::RegisterProfilePrefs(
107 user_prefs::PrefRegistrySyncable* registry) { 103 user_prefs::PrefRegistrySyncable* registry) {
108 std::string hardware_keyboard_id; 104 std::string hardware_keyboard_id;
109 // TODO(yusukes): Remove the runtime hack. 105 // TODO(yusukes): Remove the runtime hack.
110 if (base::SysInfo::IsRunningOnChromeOS()) { 106 if (base::SysInfo::IsRunningOnChromeOS()) {
111 DCHECK(g_browser_process); 107 DCHECK(g_browser_process);
112 PrefService* local_state = g_browser_process->local_state(); 108 PrefService* local_state = g_browser_process->local_state();
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 user_is_primary_ = 367 user_is_primary_ =
372 user_manager::UserManager::Get()->GetPrimaryUser() == user_; 368 user_manager::UserManager::Get()->GetPrimaryUser() == user_;
373 InitUserPrefs(prefs); 369 InitUserPrefs(prefs);
374 370
375 user_manager::UserManager::Get()->AddSessionStateObserver(this); 371 user_manager::UserManager::Get()->AddSessionStateObserver(this);
376 372
377 UserSessionManager* session_manager = UserSessionManager::GetInstance(); 373 UserSessionManager* session_manager = UserSessionManager::GetInstance();
378 DCHECK(session_manager); 374 DCHECK(session_manager);
379 ime_state_ = session_manager->GetDefaultIMEState(profile); 375 ime_state_ = session_manager->GetDefaultIMEState(profile);
380 376
381 if (user_is_primary_) {
382 g_browser_process->platform_part()
383 ->GetTimezoneResolverManager()
384 ->SetPrimaryUserPrefs(prefs_);
385 }
386
387 // Initialize preferences to currently saved state. 377 // Initialize preferences to currently saved state.
388 ApplyPreferences(REASON_INITIALIZATION, ""); 378 ApplyPreferences(REASON_INITIALIZATION, "");
389 379
390 // Note that |ime_state_| was modified by ApplyPreferences(), and 380 // Note that |ime_state_| was modified by ApplyPreferences(), and
391 // SetState() is modifying |current_input_method_| (via 381 // SetState() is modifying |current_input_method_| (via
392 // PersistUserInputMethod() ). This way SetState() here may be called only 382 // PersistUserInputMethod() ). This way SetState() here may be called only
393 // after ApplyPreferences(). 383 // after ApplyPreferences().
394 input_method_manager_->SetState(ime_state_); 384 input_method_manager_->SetState(ime_state_);
395 385
396 input_method_syncer_.reset( 386 input_method_syncer_.reset(
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 634 }
645 635
646 if (pref_name == prefs::kResolveTimezoneByGeolocation && 636 if (pref_name == prefs::kResolveTimezoneByGeolocation &&
647 reason != REASON_ACTIVE_USER_CHANGED) { 637 reason != REASON_ACTIVE_USER_CHANGED) {
648 const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation); 638 const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation);
649 if (user_is_owner) { 639 if (user_is_owner) {
650 g_browser_process->local_state()->SetBoolean( 640 g_browser_process->local_state()->SetBoolean(
651 prefs::kResolveDeviceTimezoneByGeolocation, value); 641 prefs::kResolveDeviceTimezoneByGeolocation, value);
652 } 642 }
653 if (user_is_primary_) { 643 if (user_is_primary_) {
654 g_browser_process->platform_part() 644 system::TimeZoneResolverManager* manager =
655 ->GetTimezoneResolverManager() 645 g_browser_process->platform_part()->GetTimezoneResolverManager();
656 ->UpdateTimezoneResolver(); 646 manager->SetPrimaryUserPrefs(prefs_);
647 manager->UpdateTimezoneResolver();
657 if (!value && reason == REASON_PREF_CHANGED) { 648 if (!value && reason == REASON_PREF_CHANGED) {
658 // Allow immediate timezone update on Stop + Start. 649 // Allow immediate timezone update on Stop + Start.
659 g_browser_process->local_state()->ClearPref( 650 g_browser_process->local_state()->ClearPref(
660 TimeZoneResolver::kLastTimeZoneRefreshTime); 651 TimeZoneResolver::kLastTimeZoneRefreshTime);
661 } 652 }
662 } 653 }
663 } 654 }
664 655
665 if (pref_name == prefs::kUse24HourClock || 656 if (pref_name == prefs::kUse24HourClock ||
666 reason != REASON_ACTIVE_USER_CHANGED) { 657 reason != REASON_ACTIVE_USER_CHANGED) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 touch_hud_projection_enabled_.SetValue(enabled); 745 touch_hud_projection_enabled_.SetValue(enabled);
755 } 746 }
756 747
757 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { 748 void Preferences::ActiveUserChanged(const user_manager::User* active_user) {
758 if (active_user != user_) 749 if (active_user != user_)
759 return; 750 return;
760 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); 751 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, "");
761 } 752 }
762 753
763 } // namespace chromeos 754 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698