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/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "base/task_scheduler/post_task.h" | 24 #include "base/task_scheduler/post_task.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
26 #include "chrome/browser/about_flags.h" | 26 #include "chrome/browser/about_flags.h" |
27 #include "chrome/browser/app_mode/app_mode_utils.h" | 27 #include "chrome/browser/app_mode/app_mode_utils.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 29 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
30 #include "chrome/browser/browser_shutdown.h" | 30 #include "chrome/browser/browser_shutdown.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
33 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" | 33 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
34 #include "chrome/browser/chromeos/arc/arc_util.h" | |
34 #include "chrome/browser/chromeos/base/locale_util.h" | 35 #include "chrome/browser/chromeos/base/locale_util.h" |
35 #include "chrome/browser/chromeos/boot_times_recorder.h" | 36 #include "chrome/browser/chromeos/boot_times_recorder.h" |
36 #include "chrome/browser/chromeos/first_run/first_run.h" | 37 #include "chrome/browser/chromeos/first_run/first_run.h" |
37 #include "chrome/browser/chromeos/first_run/goodies_displayer.h" | 38 #include "chrome/browser/chromeos/first_run/goodies_displayer.h" |
38 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 39 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
39 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" | 40 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
40 #include "chrome/browser/chromeos/login/chrome_restart_request.h" | 41 #include "chrome/browser/chromeos/login/chrome_restart_request.h" |
41 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 42 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
42 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" | 43 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" |
43 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 44 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 | 979 |
979 void UserSessionManager::StartCrosSession() { | 980 void UserSessionManager::StartCrosSession() { |
980 BootTimesRecorder* btl = BootTimesRecorder::Get(); | 981 BootTimesRecorder* btl = BootTimesRecorder::Get(); |
981 btl->AddLoginTimeMarker("StartSession-Start", false); | 982 btl->AddLoginTimeMarker("StartSession-Start", false); |
982 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( | 983 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( |
983 cryptohome::Identification(user_context_.GetAccountId())); | 984 cryptohome::Identification(user_context_.GetAccountId())); |
984 btl->AddLoginTimeMarker("StartSession-End", false); | 985 btl->AddLoginTimeMarker("StartSession-End", false); |
985 } | 986 } |
986 | 987 |
987 void UserSessionManager::PrepareProfile() { | 988 void UserSessionManager::PrepareProfile() { |
989 const base::FilePath profile_path = | |
990 ProfileHelper::GetProfilePathByUserIdHash(user_context_.GetUserIDHash()); | |
Junichi Uekawa
2017/04/04 23:48:13
QQ: what directory is this?
kinaba
2017/04/05 02:35:28
/home/chronos/u-$HASH
| |
991 | |
992 base::PostTaskWithTraitsAndReplyWithResult( | |
993 FROM_HERE, | |
994 base::TaskTraits() | |
995 .WithShutdownBehavior( | |
996 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
997 .WithPriority(base::TaskPriority::USER_BLOCKING) | |
998 .MayBlock(), | |
999 base::Bind(&arc::IsArcCompatibleFilesystem, profile_path), | |
1000 base::Bind(&UserSessionManager::PrepareProfileAfterFilesystemCheck, | |
1001 AsWeakPtr())); | |
1002 } | |
1003 | |
1004 void UserSessionManager::PrepareProfileAfterFilesystemCheck( | |
1005 bool arc_compatible_filesystem) { | |
988 const bool is_demo_session = | 1006 const bool is_demo_session = |
989 DemoAppLauncher::IsDemoAppSession(user_context_.GetAccountId()); | 1007 DemoAppLauncher::IsDemoAppSession(user_context_.GetAccountId()); |
990 | 1008 |
991 // TODO(nkostylev): Figure out whether demo session is using the right profile | 1009 // TODO(nkostylev): Figure out whether demo session is using the right profile |
992 // path or not. See https://codereview.chromium.org/171423009 | 1010 // path or not. See https://codereview.chromium.org/171423009 |
993 g_browser_process->profile_manager()->CreateProfileAsync( | 1011 g_browser_process->profile_manager()->CreateProfileAsync( |
994 ProfileHelper::GetProfilePathByUserIdHash(user_context_.GetUserIDHash()), | 1012 ProfileHelper::GetProfilePathByUserIdHash(user_context_.GetUserIDHash()), |
995 base::Bind(&UserSessionManager::OnProfileCreated, AsWeakPtr(), | 1013 base::Bind(&UserSessionManager::OnProfileCreated, AsWeakPtr(), |
996 user_context_, is_demo_session), | 1014 user_context_, is_demo_session, arc_compatible_filesystem), |
997 base::string16(), std::string(), std::string()); | 1015 base::string16(), std::string(), std::string()); |
998 } | 1016 } |
999 | 1017 |
1000 void UserSessionManager::OnProfileCreated(const UserContext& user_context, | 1018 void UserSessionManager::OnProfileCreated(const UserContext& user_context, |
1001 bool is_incognito_profile, | 1019 bool is_incognito_profile, |
1020 bool arc_compatible_filesystem, | |
1002 Profile* profile, | 1021 Profile* profile, |
1003 Profile::CreateStatus status) { | 1022 Profile::CreateStatus status) { |
1004 CHECK(profile); | 1023 CHECK(profile); |
1005 | 1024 |
1006 switch (status) { | 1025 switch (status) { |
1007 case Profile::CREATE_STATUS_CREATED: | 1026 case Profile::CREATE_STATUS_CREATED: |
1008 // Profile created but before initializing extensions and promo resources. | 1027 // Profile created but before initializing extensions and promo resources. |
1009 InitProfilePreferences(profile, user_context); | 1028 InitProfilePreferences(profile, user_context, arc_compatible_filesystem); |
1010 break; | 1029 break; |
1011 case Profile::CREATE_STATUS_INITIALIZED: | 1030 case Profile::CREATE_STATUS_INITIALIZED: |
1012 // Profile is created, extensions and promo resources are initialized. | 1031 // Profile is created, extensions and promo resources are initialized. |
1013 // At this point all other Chrome OS services will be notified that it is | 1032 // At this point all other Chrome OS services will be notified that it is |
1014 // safe to use this profile. | 1033 // safe to use this profile. |
1015 UserProfileInitialized(profile, is_incognito_profile, | 1034 UserProfileInitialized(profile, is_incognito_profile, |
1016 user_context.GetAccountId()); | 1035 user_context.GetAccountId()); |
1017 break; | 1036 break; |
1018 case Profile::CREATE_STATUS_LOCAL_FAIL: | 1037 case Profile::CREATE_STATUS_LOCAL_FAIL: |
1019 case Profile::CREATE_STATUS_REMOTE_FAIL: | 1038 case Profile::CREATE_STATUS_REMOTE_FAIL: |
1020 case Profile::CREATE_STATUS_CANCELED: | 1039 case Profile::CREATE_STATUS_CANCELED: |
1021 case Profile::MAX_CREATE_STATUS: | 1040 case Profile::MAX_CREATE_STATUS: |
1022 NOTREACHED(); | 1041 NOTREACHED(); |
1023 break; | 1042 break; |
1024 } | 1043 } |
1025 } | 1044 } |
1026 | 1045 |
1027 void UserSessionManager::InitProfilePreferences( | 1046 void UserSessionManager::InitProfilePreferences( |
1028 Profile* profile, | 1047 Profile* profile, |
1029 const UserContext& user_context) { | 1048 const UserContext& user_context, |
1049 bool arc_compatible_filesystem) { | |
1050 profile->GetPrefs()->SetBoolean(prefs::kArcCompatibleFilesystemChosen, | |
1051 arc_compatible_filesystem); | |
1052 | |
1030 const user_manager::User* user = | 1053 const user_manager::User* user = |
1031 ProfileHelper::Get()->GetUserByProfile(profile); | 1054 ProfileHelper::Get()->GetUserByProfile(profile); |
1032 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP && | 1055 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP && |
1033 profile->IsNewProfile()) { | 1056 profile->IsNewProfile()) { |
1034 ChromeUserManager::Get()->SetIsCurrentUserNew(true); | 1057 ChromeUserManager::Get()->SetIsCurrentUserNew(true); |
1035 } | 1058 } |
1036 | 1059 |
1037 if (user->is_active()) { | 1060 if (user->is_active()) { |
1038 input_method::InputMethodManager* manager = | 1061 input_method::InputMethodManager* manager = |
1039 input_method::InputMethodManager::Get(); | 1062 input_method::InputMethodManager::Get(); |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1947 ->browser_policy_connector_chromeos() | 1970 ->browser_policy_connector_chromeos() |
1948 ->IsEnterpriseManaged()) { | 1971 ->IsEnterpriseManaged()) { |
1949 return false; | 1972 return false; |
1950 } | 1973 } |
1951 | 1974 |
1952 // Do not show end of life notification if this is a guest session | 1975 // Do not show end of life notification if this is a guest session |
1953 return !profile->IsGuestSession(); | 1976 return !profile->IsGuestSession(); |
1954 } | 1977 } |
1955 | 1978 |
1956 } // namespace chromeos | 1979 } // namespace chromeos |
OLD | NEW |