| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/users/user_manager.h" | 5 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "chrome/browser/browser_process_platform_part_chromeos.h" | |
| 10 #include "chrome/browser/chromeos/login/users/user_manager_impl.h" | 9 #include "chrome/browser/chromeos/login/users/user_manager_impl.h" |
| 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 12 #include "chrome/common/chrome_switches.h" | |
| 13 | 11 |
| 14 namespace chromeos { | 12 namespace chromeos { |
| 15 | 13 |
| 16 // static | 14 // static |
| 17 const char UserManager::kStubUser[] = "stub-user@example.com"; | 15 const char UserManager::kStubUser[] = "stub-user@example.com"; |
| 18 | 16 |
| 19 // static | 17 // static |
| 20 const char UserManager::kSignInUser[] = "sign-in-user-id"; | 18 const char UserManager::kSignInUser[] = "sign-in-user-id"; |
| 21 | 19 |
| 22 // static | 20 // static |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 100 |
| 103 g_user_manager = user_manager; | 101 g_user_manager = user_manager; |
| 104 return previous_user_manager; | 102 return previous_user_manager; |
| 105 } | 103 } |
| 106 | 104 |
| 107 ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager) | 105 ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager) |
| 108 : previous_user_manager_(UserManager::SetForTesting(user_manager)) { | 106 : previous_user_manager_(UserManager::SetForTesting(user_manager)) { |
| 109 } | 107 } |
| 110 | 108 |
| 111 ScopedUserManagerEnabler::~ScopedUserManagerEnabler() { | 109 ScopedUserManagerEnabler::~ScopedUserManagerEnabler() { |
| 112 UserManager::Get()->Shutdown(); | 110 GetUserManager()->Shutdown(); |
| 113 UserManager::Destroy(); | 111 UserManager::Destroy(); |
| 114 UserManager::SetForTesting(previous_user_manager_); | 112 UserManager::SetForTesting(previous_user_manager_); |
| 115 } | 113 } |
| 116 | 114 |
| 117 ScopedTestUserManager::ScopedTestUserManager() { | 115 ScopedTestUserManager::ScopedTestUserManager() { |
| 118 UserManager::Initialize(); | 116 UserManager::Initialize(); |
| 119 | 117 |
| 120 // ProfileHelper has to be initialized after UserManager instance is created. | 118 // ProfileHelper has to be initialized after UserManager instance is created. |
| 121 ProfileHelper::Get()->Initialize(); | 119 ProfileHelper::Get()->Initialize(); |
| 122 } | 120 } |
| 123 | 121 |
| 124 ScopedTestUserManager::~ScopedTestUserManager() { | 122 ScopedTestUserManager::~ScopedTestUserManager() { |
| 125 UserManager::Get()->Shutdown(); | 123 GetUserManager()->Shutdown(); |
| 126 UserManager::Destroy(); | 124 UserManager::Destroy(); |
| 127 } | 125 } |
| 128 | 126 |
| 127 UserManager* GetUserManager() { |
| 128 // TODO(nkostylev): Once UserManager is moved to user_manager component switch |
| 129 // this to something line g_browser_process->platform_part()->user_manager(). |
| 130 return UserManager::Get(); |
| 131 } |
| 132 |
| 129 } // namespace chromeos | 133 } // namespace chromeos |
| OLD | NEW |