Commit f41eaddb authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Simplify LoginScreenContext

Change-Id: I95210caacd3ec104ddd77410436b4b438f74efaa
Reviewed-on: https://chromium-review.googlesource.com/1108546Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571581}
parent cfb8d519
......@@ -379,7 +379,15 @@ void CoreOobeHandler::HandleScreenAssetsLoaded(
}
void CoreOobeHandler::HandleSkipToLoginForTesting(const base::ListValue* args) {
LoginScreenContext context(args);
LoginScreenContext context;
// Parse |args|.
if (args->GetSize() > 0) {
std::string email;
if (args->GetString(0, &email))
context.set_email(email);
}
if (WizardController::default_controller())
WizardController::default_controller()->SkipToLoginForTesting(context);
}
......
......@@ -663,8 +663,7 @@ void OobeUI::ShowSigninScreen(const LoginScreenContext& context,
signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate);
LoginScreenContext actual_context(context);
actual_context.set_oobe_ui(core_handler_->show_oobe_ui());
signin_screen_handler_->Show(actual_context);
signin_screen_handler_->Show(actual_context, core_handler_->show_oobe_ui());
}
void OobeUI::ForwardAccelerator(std::string accelerator_name) {
......
......@@ -246,23 +246,7 @@ ash::mojom::UserInfoPtr GetUserInfoForAccount(const AccountId& account_id) {
// LoginScreenContext implementation ------------------------------------------
LoginScreenContext::LoginScreenContext() {
Init();
}
LoginScreenContext::LoginScreenContext(const base::ListValue* args) {
Init();
if (!args || args->GetSize() == 0)
return;
std::string email;
if (args->GetString(0, &email))
email_ = email;
}
void LoginScreenContext::Init() {
oobe_ui_ = false;
}
LoginScreenContext::LoginScreenContext() = default;
// SigninScreenHandler implementation ------------------------------------------
......@@ -579,11 +563,12 @@ void SigninScreenHandler::RegisterMessages() {
&SigninScreenHandler::HandleNewNoteLaunchAnimationDone);
}
void SigninScreenHandler::Show(const LoginScreenContext& context) {
void SigninScreenHandler::Show(const LoginScreenContext& context,
bool oobe_ui) {
CHECK(delegate_);
// Just initialize internal fields from context and call ShowImpl().
oobe_ui_ = context.oobe_ui();
oobe_ui_ = oobe_ui;
std::string email;
email = context.email();
......
......@@ -81,19 +81,13 @@ class UserContext;
class LoginScreenContext {
public:
LoginScreenContext();
explicit LoginScreenContext(const base::ListValue* args);
void set_email(const std::string& email) { email_ = email; }
const std::string& email() const { return email_; }
void set_oobe_ui(bool oobe_ui) { oobe_ui_ = oobe_ui; }
bool oobe_ui() const { return oobe_ui_; }
private:
void Init();
// Optional email to prefill in gaia signin.
std::string email_;
bool oobe_ui_;
};
// An interface for WebUILoginDisplay to call SigninScreenHandler.
......@@ -232,7 +226,7 @@ class SigninScreenHandler
input_method::InputMethodManager::State* ime_state);
// Shows the sign in screen.
void Show(const LoginScreenContext& context);
void Show(const LoginScreenContext& context, bool oobe_ui);
// Sets delegate to be used by the handler. It is guaranteed that valid
// delegate is set before Show() method will be called.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment