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 "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" | 31 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" |
32 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 32 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
33 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 33 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
34 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" | 34 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" |
35 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 35 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
36 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 36 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
37 #include "chrome/browser/chromeos/policy/device_local_account.h" | 37 #include "chrome/browser/chromeos/policy/device_local_account.h" |
38 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" | 38 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" |
39 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 39 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
40 #include "chrome/browser/chromeos/session_length_limiter.h" | 40 #include "chrome/browser/chromeos/session_length_limiter.h" |
| 41 #include "chrome/browser/chromeos/system/timezone_util.h" |
41 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
42 #include "chrome/browser/signin/easy_unlock_service.h" | 43 #include "chrome/browser/signin/easy_unlock_service.h" |
43 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" | 44 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" |
44 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce_factory.h" | 45 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce_factory.h" |
45 #include "chrome/common/chrome_constants.h" | 46 #include "chrome/common/chrome_constants.h" |
46 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
47 #include "chrome/common/crash_keys.h" | 48 #include "chrome/common/crash_keys.h" |
48 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
49 #include "chrome/grit/theme_resources.h" | 50 #include "chrome/grit/theme_resources.h" |
50 #include "chromeos/chromeos_switches.h" | 51 #include "chromeos/chromeos_switches.h" |
51 #include "chromeos/login/user_names.h" | 52 #include "chromeos/login/user_names.h" |
52 #include "chromeos/settings/cros_settings_names.h" | 53 #include "chromeos/settings/cros_settings_names.h" |
| 54 #include "chromeos/timezone/timezone_resolver.h" |
53 #include "components/session_manager/core/session_manager.h" | 55 #include "components/session_manager/core/session_manager.h" |
54 #include "components/user_manager/remove_user_delegate.h" | 56 #include "components/user_manager/remove_user_delegate.h" |
55 #include "components/user_manager/user_image/user_image.h" | 57 #include "components/user_manager/user_image/user_image.h" |
56 #include "components/user_manager/user_type.h" | 58 #include "components/user_manager/user_type.h" |
57 #include "content/public/browser/browser_thread.h" | 59 #include "content/public/browser/browser_thread.h" |
58 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
59 #include "policy/policy_constants.h" | 61 #include "policy/policy_constants.h" |
60 #include "ui/base/resource/resource_bundle.h" | 62 #include "ui/base/resource/resource_bundle.h" |
61 #include "ui/wm/core/wm_core_switches.h" | 63 #include "ui/wm/core/wm_core_switches.h" |
62 | 64 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 if (IsLoggedInAsUserWithGaiaAccount()) | 371 if (IsLoggedInAsUserWithGaiaAccount()) |
370 ManagerPasswordServiceFactory::GetForProfile(profile); | 372 ManagerPasswordServiceFactory::GetForProfile(profile); |
371 | 373 |
372 if (!profile->IsOffTheRecord()) { | 374 if (!profile->IsOffTheRecord()) { |
373 AuthSyncObserver* sync_observer = | 375 AuthSyncObserver* sync_observer = |
374 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); | 376 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); |
375 sync_observer->StartObserving(); | 377 sync_observer->StartObserving(); |
376 multi_profile_user_controller_->StartObserving(profile); | 378 multi_profile_user_controller_->StartObserving(profile); |
377 } | 379 } |
378 } | 380 } |
| 381 UpdateUserTimeZoneRefresher(profile); |
379 break; | 382 break; |
380 } | 383 } |
381 case chrome::NOTIFICATION_PROFILE_CREATED: { | 384 case chrome::NOTIFICATION_PROFILE_CREATED: { |
382 Profile* profile = content::Source<Profile>(source).ptr(); | 385 Profile* profile = content::Source<Profile>(source).ptr(); |
383 user_manager::User* user = | 386 user_manager::User* user = |
384 ProfileHelper::Get()->GetUserByProfile(profile); | 387 ProfileHelper::Get()->GetUserByProfile(profile); |
385 if (user != NULL) | 388 if (user != NULL) |
386 user->set_profile_is_created(); | 389 user->set_profile_is_created(); |
387 | 390 |
388 // If there is pending user switch, do it now. | 391 // If there is pending user switch, do it now. |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 // Write the user number as UMA stat when a multi user session is possible. | 1040 // Write the user number as UMA stat when a multi user session is possible. |
1038 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) | 1041 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
1039 ash::MultiProfileUMA::RecordUserCount(users); | 1042 ash::MultiProfileUMA::RecordUserCount(users); |
1040 } | 1043 } |
1041 | 1044 |
1042 base::debug::SetCrashKeyValue( | 1045 base::debug::SetCrashKeyValue( |
1043 crash_keys::kNumberOfUsers, | 1046 crash_keys::kNumberOfUsers, |
1044 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1047 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
1045 } | 1048 } |
1046 | 1049 |
| 1050 void ChromeUserManagerImpl::UpdateUserTimeZoneRefresher(Profile* profile) { |
| 1051 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1052 chromeos::switches::kEnableTimeZoneTrackingOption)) { |
| 1053 return; |
| 1054 } |
| 1055 |
| 1056 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); |
| 1057 if (user == NULL) |
| 1058 return; |
| 1059 |
| 1060 // In Multi-Profile mode only primary user settings are in effect. |
| 1061 if (user != user_manager::UserManager::Get()->GetPrimaryUser()) |
| 1062 return; |
| 1063 |
| 1064 if (!IsUserLoggedIn()) |
| 1065 return; |
| 1066 |
| 1067 // Timezone auto refresh is disabled for Guest, Supervized and OffTheRecord |
| 1068 // users, but enabled for Kiosk mode. |
| 1069 if (IsLoggedInAsGuest() || IsLoggedInAsSupervisedUser() || |
| 1070 profile->IsOffTheRecord()) { |
| 1071 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); |
| 1072 return; |
| 1073 } |
| 1074 |
| 1075 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) && |
| 1076 !system::HasSystemTimezonePolicy()) { |
| 1077 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); |
| 1078 } else { |
| 1079 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); |
| 1080 } |
| 1081 } |
| 1082 |
1047 } // namespace chromeos | 1083 } // namespace chromeos |
OLD | NEW |