OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/login/users/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" | 29 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" |
30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" | 30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" |
31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
32 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 32 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
33 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" | 33 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" |
34 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 34 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
35 #include "chrome/browser/chromeos/policy/device_local_account.h" | 35 #include "chrome/browser/chromeos/policy/device_local_account.h" |
36 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" | 36 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" |
37 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 37 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
38 #include "chrome/browser/chromeos/session_length_limiter.h" | 38 #include "chrome/browser/chromeos/session_length_limiter.h" |
| 39 #include "chrome/browser/chromeos/system/timezone_util.h" |
39 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
40 #include "chrome/browser/signin/easy_unlock_service.h" | 41 #include "chrome/browser/signin/easy_unlock_service.h" |
41 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" | 42 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" |
42 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce_factory.h" | 43 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce_factory.h" |
43 #include "chrome/common/chrome_constants.h" | 44 #include "chrome/common/chrome_constants.h" |
44 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/crash_keys.h" | 46 #include "chrome/common/crash_keys.h" |
46 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
47 #include "chrome/grit/theme_resources.h" | 48 #include "chrome/grit/theme_resources.h" |
48 #include "chromeos/chromeos_switches.h" | 49 #include "chromeos/chromeos_switches.h" |
49 #include "chromeos/login/user_names.h" | 50 #include "chromeos/login/user_names.h" |
50 #include "chromeos/settings/cros_settings_names.h" | 51 #include "chromeos/settings/cros_settings_names.h" |
| 52 #include "chromeos/timezone/timezone_resolver.h" |
51 #include "components/session_manager/core/session_manager.h" | 53 #include "components/session_manager/core/session_manager.h" |
52 #include "components/user_manager/remove_user_delegate.h" | 54 #include "components/user_manager/remove_user_delegate.h" |
53 #include "components/user_manager/user_image/user_image.h" | 55 #include "components/user_manager/user_image/user_image.h" |
54 #include "components/user_manager/user_type.h" | 56 #include "components/user_manager/user_type.h" |
55 #include "content/public/browser/browser_thread.h" | 57 #include "content/public/browser/browser_thread.h" |
56 #include "content/public/browser/notification_service.h" | 58 #include "content/public/browser/notification_service.h" |
57 #include "policy/policy_constants.h" | 59 #include "policy/policy_constants.h" |
58 #include "ui/base/resource/resource_bundle.h" | 60 #include "ui/base/resource/resource_bundle.h" |
59 #include "ui/wm/core/wm_core_switches.h" | 61 #include "ui/wm/core/wm_core_switches.h" |
60 | 62 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if (IsLoggedInAsUserWithGaiaAccount()) | 374 if (IsLoggedInAsUserWithGaiaAccount()) |
373 ManagerPasswordServiceFactory::GetForProfile(profile); | 375 ManagerPasswordServiceFactory::GetForProfile(profile); |
374 | 376 |
375 if (!profile->IsOffTheRecord()) { | 377 if (!profile->IsOffTheRecord()) { |
376 AuthSyncObserver* sync_observer = | 378 AuthSyncObserver* sync_observer = |
377 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); | 379 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); |
378 sync_observer->StartObserving(); | 380 sync_observer->StartObserving(); |
379 multi_profile_user_controller_->StartObserving(profile); | 381 multi_profile_user_controller_->StartObserving(profile); |
380 } | 382 } |
381 } | 383 } |
| 384 UpdateUserTimeZoneRefresher(profile); |
382 break; | 385 break; |
383 } | 386 } |
384 case chrome::NOTIFICATION_PROFILE_CREATED: { | 387 case chrome::NOTIFICATION_PROFILE_CREATED: { |
385 Profile* profile = content::Source<Profile>(source).ptr(); | 388 Profile* profile = content::Source<Profile>(source).ptr(); |
386 user_manager::User* user = | 389 user_manager::User* user = |
387 ProfileHelper::Get()->GetUserByProfile(profile); | 390 ProfileHelper::Get()->GetUserByProfile(profile); |
388 if (user != NULL) | 391 if (user != NULL) |
389 user->set_profile_is_created(); | 392 user->set_profile_is_created(); |
390 | 393 |
391 // If there is pending user switch, do it now. | 394 // If there is pending user switch, do it now. |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) | 1073 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
1071 ash::MultiProfileUMA::RecordUserCount(users); | 1074 ash::MultiProfileUMA::RecordUserCount(users); |
1072 } | 1075 } |
1073 #endif | 1076 #endif |
1074 | 1077 |
1075 base::debug::SetCrashKeyValue( | 1078 base::debug::SetCrashKeyValue( |
1076 crash_keys::kNumberOfUsers, | 1079 crash_keys::kNumberOfUsers, |
1077 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1080 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
1078 } | 1081 } |
1079 | 1082 |
| 1083 void ChromeUserManagerImpl::UpdateUserTimeZoneRefresher(Profile* profile) { |
| 1084 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1085 chromeos::switches::kEnableTimeZoneTrackingOption)) { |
| 1086 return; |
| 1087 } |
| 1088 |
| 1089 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); |
| 1090 if (user == NULL) |
| 1091 return; |
| 1092 |
| 1093 // In Multi-Profile mode only primary user settings are in effect. |
| 1094 if (user != user_manager::UserManager::Get()->GetPrimaryUser()) |
| 1095 return; |
| 1096 |
| 1097 if (!IsUserLoggedIn()) |
| 1098 return; |
| 1099 |
| 1100 // Timezone auto refresh is disabled for Guest, Supervized and OffTheRecord |
| 1101 // users, but enabled for Kiosk mode. |
| 1102 if (IsLoggedInAsGuest() || IsLoggedInAsSupervisedUser() || |
| 1103 profile->IsOffTheRecord()) { |
| 1104 g_browser_process->platform_part()->timezone_resolver()->Stop(); |
| 1105 return; |
| 1106 } |
| 1107 |
| 1108 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) && |
| 1109 !system::HasSystemTimezonePolicy()) { |
| 1110 g_browser_process->platform_part()->timezone_resolver()->Start(); |
| 1111 } else { |
| 1112 g_browser_process->platform_part()->timezone_resolver()->Stop(); |
| 1113 } |
| 1114 } |
| 1115 |
1080 } // namespace chromeos | 1116 } // namespace chromeos |
OLD | NEW |