| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return NULL; | 288 return NULL; |
| 289 | 289 |
| 290 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 290 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 291 | 291 |
| 292 // Special case for non-CrOS tests that do create several profiles | 292 // Special case for non-CrOS tests that do create several profiles |
| 293 // and don't really care about mapping to the real user. | 293 // and don't really care about mapping to the real user. |
| 294 // Without multi-profiles on Chrome OS such tests always got active_user_. | 294 // Without multi-profiles on Chrome OS such tests always got active_user_. |
| 295 // Now these tests will specify special flag to continue working. | 295 // Now these tests will specify special flag to continue working. |
| 296 // In future those tests can get a proper CrOS configuration i.e. register | 296 // In future those tests can get a proper CrOS configuration i.e. register |
| 297 // and login several users if they want to work with an additional profile. | 297 // and login several users if they want to work with an additional profile. |
| 298 if (CommandLine::ForCurrentProcess()->HasSwitch( | 298 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 299 switches::kIgnoreUserProfileMappingForTests)) { | 299 switches::kIgnoreUserProfileMappingForTests)) { |
| 300 return user_manager->GetActiveUser(); | 300 return user_manager->GetActiveUser(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 const std::string username_hash = | 303 const std::string username_hash = |
| 304 ProfileHelper::GetUserIdHashFromProfile(profile); | 304 ProfileHelper::GetUserIdHashFromProfile(profile); |
| 305 const user_manager::UserList& users = user_manager->GetUsers(); | 305 const user_manager::UserList& users = user_manager->GetUsers(); |
| 306 const user_manager::UserList::const_iterator pos = std::find_if( | 306 const user_manager::UserList::const_iterator pos = std::find_if( |
| 307 users.begin(), users.end(), UsernameHashMatcher(username_hash)); | 307 users.begin(), users.end(), UsernameHashMatcher(username_hash)); |
| 308 if (pos != users.end()) | 308 if (pos != users.end()) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 user_to_profile_for_testing_[user] = profile; | 376 user_to_profile_for_testing_[user] = profile; |
| 377 } | 377 } |
| 378 | 378 |
| 379 // static | 379 // static |
| 380 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( | 380 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( |
| 381 const std::string& user_id) { | 381 const std::string& user_id) { |
| 382 return user_id + kUserIdHashSuffix; | 382 return user_id + kUserIdHashSuffix; |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace chromeos | 385 } // namespace chromeos |
| OLD | NEW |