#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/prefs/session_startup_pref.h"
+#include "chrome/browser/signin/easy_unlock_service.h"
#include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/dbus/session_manager_client.h"
-#include "chromeos/login/auth/user_context.h"
#include "chromeos/login/user_names.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/google/core/browser/google_util.h"
base::Bind(&RefreshPoliciesOnUIThread));
}
+// Record UMA for Easy sign-in outcome.
+void RecordEasySignInOutcome(const std::string& user_id, bool success) {
+ EasyUnlockService* easy_unlock_service =
+ EasyUnlockService::Get(ProfileHelper::GetSigninProfile());
+ if (!easy_unlock_service)
+ return;
+ easy_unlock_service->RecordEasySignInOutcome(user_id, success);
+}
+
+// Record UMA for password login of regular user when Easy sign-in is enabled.
+void RecordPasswordLoginEvent(const UserContext& user_context) {
+ EasyUnlockService* easy_unlock_service =
+ EasyUnlockService::Get(ProfileHelper::GetSigninProfile());
+ if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR &&
+ user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE &&
+ easy_unlock_service) {
+ easy_unlock_service->RecordPasswordLoginEvent(user_context.GetUserID());
+ }
+}
+
} // namespace
// static
ExistingUserController::ExistingUserController(LoginDisplayHost* host)
: auth_status_consumer_(NULL),
+ last_login_attempt_auth_flow_(UserContext::AUTH_FLOW_OFFLINE),
host_(host),
login_display_(host_->CreateLoginDisplay(this)),
num_login_attempts_(0),
cros_settings_(CrosSettings::Get()),
- weak_factory_(this),
offline_failed_(false),
is_login_in_progress_(false),
password_changed_(false),
auth_mode_(LoginPerformer::AUTH_MODE_EXTENSION),
do_auto_enrollment_(false),
signin_screen_ready_(false),
- network_state_helper_(new login::NetworkStateHelper) {
+ network_state_helper_(new login::NetworkStateHelper),
+ weak_factory_(this) {
DCHECK(current_controller_ == NULL);
current_controller_ = this;
// Disable UI while loading user profile.
login_display_->SetUIEnabled(false);
+ last_login_attempt_auth_flow_ = user_context.GetAuthFlow();
+
// Use the same LoginPerformer for subsequent login as it has state
// such as Authenticator instance.
if (!login_performer_.get() || num_login_attempts_ <= 1) {
login_performer_->LoginAsSupervisedUser(user_context);
} else {
login_performer_->PerformLogin(user_context, auth_mode);
+ RecordPasswordLoginEvent(user_context);
}
SendAccessibilityAlert(
l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN));
guest_mode_url_ = GURL::EmptyGURL();
std::string error = failure.GetErrorString();
+ // TODO(xiyuan): Move into EasyUnlockUserLoginFlow.
+ if (last_login_attempt_auth_flow_ == UserContext::AUTH_FLOW_EASY_UNLOCK)
+ RecordEasySignInOutcome(last_login_attempt_username_, false);
+
if (ChromeUserManager::Get()
->GetUserFlow(last_login_attempt_username_)
->HandleLoginFailure(failure)) {
->GetUserFlow(user_context.GetUserID())
->HandleLoginSuccess(user_context);
+ // TODO(xiyuan): Move into EasyUnlockUserLoginFlow.
+ if (last_login_attempt_auth_flow_ == UserContext::AUTH_FLOW_EASY_UNLOCK) {
+ DCHECK_EQ(last_login_attempt_username_, user_context.GetUserID());
+ DCHECK_EQ(last_login_attempt_auth_flow_, user_context.GetAuthFlow());
+ RecordEasySignInOutcome(last_login_attempt_username_, true);
+ }
+
StopPublicSessionAutoLoginTimer();
const bool has_auth_cookies =