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

Side by Side Diff: chrome/browser/chromeos/profiles/profile_helper.cc

Issue 594163002: Restore last used user session after crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: special case in ChromeUserManagerImpl Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/profiles/profile_helper.h" 5 #include "chrome/browser/chromeos/profiles/profile_helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/browsing_data/browsing_data_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_helper.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return it == user_to_profile_for_testing_.end() ? NULL : it->second; 241 return it == user_to_profile_for_testing_.end() ? NULL : it->second;
242 } 242 }
243 243
244 Profile* profile = NULL; 244 Profile* profile = NULL;
245 if (user->is_profile_created()) { 245 if (user->is_profile_created()) {
246 profile = ProfileHelper::GetProfileByUserIdHash(user->username_hash()); 246 profile = ProfileHelper::GetProfileByUserIdHash(user->username_hash());
247 } else { 247 } else {
248 LOG(WARNING) << "ProfileHelper::GetProfileByUserUnsafe is called when " 248 LOG(WARNING) << "ProfileHelper::GetProfileByUserUnsafe is called when "
249 "|user|'s profile is not created. It probably means that " 249 "|user|'s profile is not created. It probably means that "
250 "something is wrong with a calling code. Please report in " 250 "something is wrong with a calling code. Please report in "
251 "http://crbug.com/361528 if you see this message."; 251 "http://crbug.com/361528 if you see this message. user_id: "
252 << user->email();
252 profile = ProfileManager::GetActiveUserProfile(); 253 profile = ProfileManager::GetActiveUserProfile();
253 } 254 }
254 255
255 // GetActiveUserProfile() or GetProfileByUserIdHash() returns a new instance 256 // GetActiveUserProfile() or GetProfileByUserIdHash() returns a new instance
256 // of ProfileImpl(), but actually its OffTheRecordProfile() should be used. 257 // of ProfileImpl(), but actually its OffTheRecordProfile() should be used.
257 if (profile && user_manager::UserManager::Get()->IsLoggedInAsGuest()) 258 if (profile && user_manager::UserManager::Get()->IsLoggedInAsGuest())
258 profile = profile->GetOffTheRecordProfile(); 259 profile = profile->GetOffTheRecordProfile();
259 return profile; 260 return profile;
260 } 261 }
261 262
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 user_to_profile_for_testing_[user] = profile; 376 user_to_profile_for_testing_[user] = profile;
376 } 377 }
377 378
378 // static 379 // static
379 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( 380 std::string ProfileHelper::GetUserIdHashByUserIdForTesting(
380 const std::string& user_id) { 381 const std::string& user_id) {
381 return user_id + kUserIdHashSuffix; 382 return user_id + kUserIdHashSuffix;
382 } 383 }
383 384
384 } // namespace chromeos 385 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698