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/app_mode/kiosk_profile_loader.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 KioskProfileLoader* loader_; | 110 KioskProfileLoader* loader_; |
111 int retry_count_; | 111 int retry_count_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(CryptohomedChecker); | 113 DISALLOW_COPY_AND_ASSIGN(CryptohomedChecker); |
114 }; | 114 }; |
115 | 115 |
116 | 116 |
117 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
118 // KioskProfileLoader | 118 // KioskProfileLoader |
119 | 119 |
120 KioskProfileLoader::KioskProfileLoader(const std::string& app_user_id, | 120 KioskProfileLoader::KioskProfileLoader(const user_manager::UserID& app_user_id, |
121 bool use_guest_mount, | 121 bool use_guest_mount, |
122 Delegate* delegate) | 122 Delegate* delegate) |
123 : user_id_(app_user_id), | 123 : user_id_(app_user_id), |
124 use_guest_mount_(use_guest_mount), | 124 use_guest_mount_(use_guest_mount), |
125 delegate_(delegate) {} | 125 delegate_(delegate) {} |
126 | 126 |
127 KioskProfileLoader::~KioskProfileLoader() {} | 127 KioskProfileLoader::~KioskProfileLoader() {} |
128 | 128 |
129 void KioskProfileLoader::Start() { | 129 void KioskProfileLoader::Start() { |
130 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 130 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 19 matching lines...) Expand all Loading... |
150 // LoginPerformer will delete itself. | 150 // LoginPerformer will delete itself. |
151 login_performer_->set_delegate(NULL); | 151 login_performer_->set_delegate(NULL); |
152 ignore_result(login_performer_.release()); | 152 ignore_result(login_performer_.release()); |
153 | 153 |
154 // If we are launching a demo session, we need to start MountGuest with the | 154 // If we are launching a demo session, we need to start MountGuest with the |
155 // guest username; this is because there are several places in the cros code | 155 // guest username; this is because there are several places in the cros code |
156 // which rely on the username sent to cryptohome to be $guest. Back in Chrome | 156 // which rely on the username sent to cryptohome to be $guest. Back in Chrome |
157 // we switch this back to the demo user name to correctly identify this | 157 // we switch this back to the demo user name to correctly identify this |
158 // user as a demo user. | 158 // user as a demo user. |
159 UserContext context = user_context; | 159 UserContext context = user_context; |
160 if (context.GetUserID() == chromeos::login::kGuestUserName) | 160 if (context.GetUserID() == chromeos::login::GetGuestUserID()) |
161 context.SetUserID(DemoAppLauncher::kDemoUserName); | 161 context.SetUserID(DemoAppLauncher::GetDemoUserID()); |
162 UserSessionManager::GetInstance()->StartSession( | 162 UserSessionManager::GetInstance()->StartSession( |
163 context, UserSessionManager::PRIMARY_USER_SESSION, | 163 context, UserSessionManager::PRIMARY_USER_SESSION, |
164 false, // has_auth_cookies | 164 false, // has_auth_cookies |
165 false, // Start session for user. | 165 false, // Start session for user. |
166 this); | 166 this); |
167 } | 167 } |
168 | 168 |
169 void KioskProfileLoader::OnAuthFailure(const AuthFailure& error) { | 169 void KioskProfileLoader::OnAuthFailure(const AuthFailure& error) { |
170 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); | 170 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); |
171 } | 171 } |
172 | 172 |
173 void KioskProfileLoader::WhiteListCheckFailed(const std::string& email) { | 173 void KioskProfileLoader::WhiteListCheckFailed(const user_manager::UserID& user_i
d) { |
174 NOTREACHED(); | 174 NOTREACHED(); |
175 } | 175 } |
176 | 176 |
177 void KioskProfileLoader::PolicyLoadFailed() { | 177 void KioskProfileLoader::PolicyLoadFailed() { |
178 ReportLaunchResult(KioskAppLaunchError::POLICY_LOAD_FAILED); | 178 ReportLaunchResult(KioskAppLaunchError::POLICY_LOAD_FAILED); |
179 } | 179 } |
180 | 180 |
181 void KioskProfileLoader::OnOnlineChecked( | 181 void KioskProfileLoader::OnOnlineChecked( |
182 const std::string& email, bool success) { | 182 const user_manager::UserID& user_id, bool success) { |
183 NOTREACHED(); | 183 NOTREACHED(); |
184 } | 184 } |
185 | 185 |
186 void KioskProfileLoader::OnProfilePrepared(Profile* profile, | 186 void KioskProfileLoader::OnProfilePrepared(Profile* profile, |
187 bool browser_launched) { | 187 bool browser_launched) { |
188 // This object could be deleted any time after successfully reporting | 188 // This object could be deleted any time after successfully reporting |
189 // a profile load, so invalidate the delegate now. | 189 // a profile load, so invalidate the delegate now. |
190 UserSessionManager::GetInstance()->DelegateDeleted(this); | 190 UserSessionManager::GetInstance()->DelegateDeleted(this); |
191 | 191 |
192 delegate_->OnProfileLoaded(profile); | 192 delegate_->OnProfileLoaded(profile); |
193 ReportLaunchResult(KioskAppLaunchError::NONE); | 193 ReportLaunchResult(KioskAppLaunchError::NONE); |
194 } | 194 } |
195 | 195 |
196 } // namespace chromeos | 196 } // namespace chromeos |
OLD | NEW |