| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |