OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fake_login_utils.h" | 5 #include "chrome/browser/chromeos/login/fake_login_utils.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" | 10 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 user_context.GetUserID(), user_context.GetUserIDHash(), false); | 62 user_context.GetUserID(), user_context.GetUserIDHash(), false); |
63 User* user = UserManager::Get()->FindUserAndModify(user_context.GetUserID()); | 63 User* user = UserManager::Get()->FindUserAndModify(user_context.GetUserID()); |
64 DCHECK(user); | 64 DCHECK(user); |
65 | 65 |
66 // Make sure that we get the real Profile instead of the login Profile. | 66 // Make sure that we get the real Profile instead of the login Profile. |
67 user->set_profile_is_created(); | 67 user->set_profile_is_created(); |
68 Profile* profile = UserManager::Get()->GetProfileByUser(user); | 68 Profile* profile = UserManager::Get()->GetProfileByUser(user); |
69 | 69 |
70 if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { | 70 if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { |
71 User* active_user = UserManager::Get()->GetActiveUser(); | 71 User* active_user = UserManager::Get()->GetActiveUser(); |
72 std::string managed_user_sync_id = | 72 std::string supervised_user_sync_id = |
73 UserManager::Get()->GetSupervisedUserManager()-> | 73 UserManager::Get()->GetSupervisedUserManager()-> |
74 GetUserSyncId(active_user->email()); | 74 GetUserSyncId(active_user->email()); |
75 if (managed_user_sync_id.empty()) | 75 if (supervised_user_sync_id.empty()) |
76 managed_user_sync_id = "DUMMY ID"; | 76 supervised_user_sync_id = "DUMMY ID"; |
77 profile->GetPrefs()->SetString(prefs::kManagedUserId, | 77 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, |
78 managed_user_sync_id); | 78 supervised_user_sync_id); |
79 } | 79 } |
80 | 80 |
81 content::NotificationService::current()->Notify( | 81 content::NotificationService::current()->Notify( |
82 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 82 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
83 content::NotificationService::AllSources(), | 83 content::NotificationService::AllSources(), |
84 content::Details<Profile>(profile)); | 84 content::Details<Profile>(profile)); |
85 if (delegate) | 85 if (delegate) |
86 delegate->OnProfilePrepared(profile); | 86 delegate->OnProfilePrepared(profile); |
87 } | 87 } |
88 | 88 |
(...skipping 13 matching lines...) Expand all Loading... |
102 | 102 |
103 void FakeLoginUtils::SetExpectedCredentials(const UserContext& user_context) { | 103 void FakeLoginUtils::SetExpectedCredentials(const UserContext& user_context) { |
104 expected_user_context_ = user_context; | 104 expected_user_context_ = user_context; |
105 if (authenticator_) { | 105 if (authenticator_) { |
106 static_cast<MockAuthenticator*>(authenticator_.get())-> | 106 static_cast<MockAuthenticator*>(authenticator_.get())-> |
107 SetExpectedCredentials(user_context); | 107 SetExpectedCredentials(user_context); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 } // namespace chromeos | 111 } // namespace chromeos |
OLD | NEW |