This source file includes following definitions.
- LocalStateChanged
- ActiveUserChanged
- UserAddedToSession
- ActiveUserHashChanged
- PendingUserSessionsRestoreFinished
- locale_
- Initialize
- IsInitialized
- Destroy
- Get
- IsMultipleProfilesAllowed
- SetForTesting
#include "chrome/browser/chromeos/login/user_manager.h"
#include "base/command_line.h"
#include "base/prefs/pref_registry_simple.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part_chromeos.h"
#include "chrome/browser/chromeos/login/user_manager_impl.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/common/chrome_switches.h"
namespace chromeos {
const char UserManager::kStubUser[] = "stub-user@example.com";
const char UserManager::kSignInUser[] = "sign-in-user-id";
const char UserManager::kGuestUserName[] = "$guest";
const char UserManager::kLocallyManagedUserDomain[] =
"locally-managed.localhost";
const char UserManager::kRetailModeUserName[] = "demouser@";
static UserManager* g_user_manager = NULL;
UserManager::Observer::~Observer() {
}
void UserManager::Observer::LocalStateChanged(UserManager* user_manager) {
}
void UserManager::UserSessionStateObserver::ActiveUserChanged(
const User* active_user) {
}
void UserManager::UserSessionStateObserver::UserAddedToSession(
const User* active_user) {
}
void UserManager::UserSessionStateObserver::ActiveUserHashChanged(
const std::string& hash) {
}
void UserManager::UserSessionStateObserver::
PendingUserSessionsRestoreFinished() {
}
UserManager::UserSessionStateObserver::~UserSessionStateObserver() {
}
UserManager::UserAccountData::UserAccountData(const base::string16& display_name,
const base::string16& given_name,
const std::string& locale)
: display_name_(display_name),
given_name_(given_name),
locale_(locale) {
}
UserManager::UserAccountData::~UserAccountData() {}
void UserManager::Initialize() {
CHECK(!g_user_manager);
g_user_manager = new UserManagerImpl();
}
bool UserManager::IsInitialized() {
return g_user_manager;
}
void UserManager::Destroy() {
DCHECK(g_user_manager);
delete g_user_manager;
g_user_manager = NULL;
}
UserManager* UserManager::Get() {
CHECK(g_user_manager);
return g_user_manager;
}
bool UserManager::IsMultipleProfilesAllowed() {
return CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kMultiProfiles);
}
UserManager::~UserManager() {
}
UserManager* UserManager::SetForTesting(UserManager* user_manager) {
UserManager* previous_user_manager = g_user_manager;
g_user_manager = user_manager;
return previous_user_manager;
}
ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager)
: previous_user_manager_(UserManager::SetForTesting(user_manager)) {
}
ScopedUserManagerEnabler::~ScopedUserManagerEnabler() {
UserManager::Get()->Shutdown();
UserManager::Destroy();
UserManager::SetForTesting(previous_user_manager_);
}
ScopedTestUserManager::ScopedTestUserManager() {
UserManager::Initialize();
g_browser_process->platform_part()->profile_helper()->Initialize();
}
ScopedTestUserManager::~ScopedTestUserManager() {
UserManager::Get()->Shutdown();
UserManager::Destroy();
}
}