This source file includes following definitions.
- CheckProfileManagementFlag
- IsEnableWebBasedSignin
- IsGoogleProfileInfo
- IsNewProfileManagement
- IsFastUserSwitching
#include "chrome/common/profile_management_switches.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "chrome/common/chrome_switches.h"
namespace {
const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement";
bool CheckProfileManagementFlag(std::string command_switch, bool active_state) {
if (CommandLine::ForCurrentProcess()->HasSwitch(command_switch)) {
return true;
}
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNewProfileManagement)) {
return active_state;
}
std::string trial_type =
base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
if (!trial_type.empty()) {
if (trial_type == "Enabled")
return active_state;
if (trial_type == "Disabled")
return !active_state;
}
return false;
}
}
namespace switches {
bool IsEnableWebBasedSignin() {
return CheckProfileManagementFlag(switches::kEnableWebBasedSignin, false);
}
bool IsGoogleProfileInfo() {
return CheckProfileManagementFlag(switches::kGoogleProfileInfo, true);
}
bool IsNewProfileManagement() {
return CheckProfileManagementFlag(switches::kNewProfileManagement, true);
}
bool IsFastUserSwitching() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kFastUserSwitching);
}
}