Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 7049002: Move the check to detect first login before adding the User to the UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code Review Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Check user's profile for kApplicationLocale setting. 162 // Check user's profile for kApplicationLocale setting.
163 void RespectLocalePreference(Profile* pref); 163 void RespectLocalePreference(Profile* pref);
164 164
165 // The current background view. 165 // The current background view.
166 chromeos::BackgroundView* background_view_; 166 chromeos::BackgroundView* background_view_;
167 167
168 std::string username_; 168 std::string username_;
169 std::string password_; 169 std::string password_;
170 GaiaAuthConsumer::ClientLoginResult credentials_; 170 GaiaAuthConsumer::ClientLoginResult credentials_;
171 bool pending_requests_; 171 bool pending_requests_;
172 bool first_login_;
172 173
173 // Delegate to be fired when the profile will be prepared. 174 // Delegate to be fired when the profile will be prepared.
174 LoginUtils::Delegate* delegate_; 175 LoginUtils::Delegate* delegate_;
175 176
176 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); 177 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl);
177 }; 178 };
178 179
179 class LoginUtilsWrapper { 180 class LoginUtilsWrapper {
180 public: 181 public:
181 static LoginUtilsWrapper* GetInstance() { 182 static LoginUtilsWrapper* GetInstance() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 BootTimesLoader* btl = BootTimesLoader::Get(); 214 BootTimesLoader* btl = BootTimesLoader::Get();
214 215
215 VLOG(1) << "Completing login for " << username; 216 VLOG(1) << "Completing login for " << username;
216 btl->AddLoginTimeMarker("CompletingLogin", false); 217 btl->AddLoginTimeMarker("CompletingLogin", false);
217 218
218 if (CrosLibrary::Get()->EnsureLoaded()) { 219 if (CrosLibrary::Get()->EnsureLoaded()) {
219 CrosLibrary::Get()->GetLoginLibrary()->StartSession(username, ""); 220 CrosLibrary::Get()->GetLoginLibrary()->StartSession(username, "");
220 btl->AddLoginTimeMarker("StartedSession", false); 221 btl->AddLoginTimeMarker("StartedSession", false);
221 } 222 }
222 223
224 // Record whether this is the first login before we add the user to the
225 // UserManager.
226 first_login_ = !UserManager::Get()->IsKnownUser(username);
227
223 UserManager::Get()->UserLoggedIn(username); 228 UserManager::Get()->UserLoggedIn(username);
224 btl->AddLoginTimeMarker("UserLoggedIn", false); 229 btl->AddLoginTimeMarker("UserLoggedIn", false);
225 230
226 // Switch log file as soon as possible. 231 // Switch log file as soon as possible.
227 logging::RedirectChromeLogging(*(CommandLine::ForCurrentProcess())); 232 logging::RedirectChromeLogging(*(CommandLine::ForCurrentProcess()));
228 btl->AddLoginTimeMarker("LoggingRedirected", false); 233 btl->AddLoginTimeMarker("LoggingRedirected", false);
229 234
230 username_ = username; 235 username_ = username;
231 password_ = password; 236 password_ = password;
232 credentials_ = credentials; 237 credentials_ = credentials;
233 pending_requests_ = pending_requests; 238 pending_requests_ = pending_requests;
234 delegate_ = delegate; 239 delegate_ = delegate;
235 240
236 // The default profile will have been changed because the ProfileManager 241 // The default profile will have been changed because the ProfileManager
237 // will process the notification that the UserManager sends out. 242 // will process the notification that the UserManager sends out.
238 ProfileManager::CreateDefaultProfileAsync(this); 243 ProfileManager::CreateDefaultProfileAsync(this);
239 } 244 }
240 245
241 void LoginUtilsImpl::OnProfileCreated(Profile* profile) { 246 void LoginUtilsImpl::OnProfileCreated(Profile* profile) {
242 CHECK(profile); 247 CHECK(profile);
243 248
244 BootTimesLoader* btl = BootTimesLoader::Get(); 249 BootTimesLoader* btl = BootTimesLoader::Get();
245 btl->AddLoginTimeMarker("UserProfileGotten", false); 250 btl->AddLoginTimeMarker("UserProfileGotten", false);
246 251
247 bool first_login = !UserManager::Get()->IsKnownUser(username_);
248 // Change the proxy configuration service of the default request context to 252 // Change the proxy configuration service of the default request context to
249 // use the preference configuration from the logged-in profile. This ensures 253 // use the preference configuration from the logged-in profile. This ensures
250 // that requests done through the default context use the proxy configuration 254 // that requests done through the default context use the proxy configuration
251 // provided by configuration policy. 255 // provided by configuration policy.
252 // 256 //
253 // Note: Many of the clients of the default request context should probably be 257 // Note: Many of the clients of the default request context should probably be
254 // fixed to use the request context of the profile they are associated with. 258 // fixed to use the request context of the profile they are associated with.
255 // This includes preconnect, autofill, metrics service to only name a few; 259 // This includes preconnect, autofill, metrics service to only name a few;
256 // see http://code.google.com/p/chromium/issues/detail?id=64339 for details. 260 // see http://code.google.com/p/chromium/issues/detail?id=64339 for details.
257 // 261 //
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 cryptohome->TpmClearStoredPassword(); 317 cryptohome->TpmClearStoredPassword();
314 } else { 318 } else {
315 cryptohome->TpmCanAttemptOwnership(); 319 cryptohome->TpmCanAttemptOwnership();
316 } 320 }
317 } 321 }
318 } 322 }
319 btl->AddLoginTimeMarker("TPMOwned", false); 323 btl->AddLoginTimeMarker("TPMOwned", false);
320 324
321 RespectLocalePreference(profile); 325 RespectLocalePreference(profile);
322 326
323 if (first_login) { 327 if (first_login_) {
Nikita (slow) 2011/05/20 09:33:46 Turns out that UserManager has bool current_user_i
Zachary Kuznia 2011/05/23 08:06:35 Done.
324 SetFirstLoginPrefs(profile->GetPrefs()); 328 SetFirstLoginPrefs(profile->GetPrefs());
325 } 329 }
326 330
327 // Enable/disable plugins based on user preferences. 331 // Enable/disable plugins based on user preferences.
328 PluginUpdater::GetInstance()->SetProfile(profile); 332 PluginUpdater::GetInstance()->SetProfile(profile);
329 btl->AddLoginTimeMarker("PluginsStateUpdated", false); 333 btl->AddLoginTimeMarker("PluginsStateUpdated", false);
330 334
331 // We suck. This is a hack since we do not have the enterprise feature 335 // We suck. This is a hack since we do not have the enterprise feature
332 // done yet to pull down policies from the domain admin. We'll take this 336 // done yet to pull down policies from the domain admin. We'll take this
333 // out when we get that done properly. 337 // out when we get that done properly.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // Mark login host for deletion after browser starts. This 598 // Mark login host for deletion after browser starts. This
595 // guarantees that the message loop will be referenced by the 599 // guarantees that the message loop will be referenced by the
596 // browser before it is dereferenced by the login host. 600 // browser before it is dereferenced by the login host.
597 if (login_host) { 601 if (login_host) {
598 login_host->OnSessionStart(); 602 login_host->OnSessionStart();
599 login_host = NULL; 603 login_host = NULL;
600 } 604 }
601 } 605 }
602 606
603 } // namespace chromeos 607 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698