Commit 69e10f2f authored by Aga Wronska's avatar Aga Wronska Committed by Commit Bot

Do not show expanded view for Public Session in Demo Mode.

Skip showing expanded login view and start Public Session right
away after user clicks the button on login view.
Use default locale and input method.

This change applies only to views login.

Bug: 882692
Test: Manually + run ash_unittests
Change-Id: I85945e813cf61dd84008fab05a4a2dce728d0939
Reviewed-on: https://chromium-review.googlesource.com/1226254
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591516}
parent 1a9ffad8
......@@ -1538,6 +1538,25 @@ keyboard::KeyboardController* LockContentsView::GetKeyboardController() const {
}
void LockContentsView::OnPublicAccountTapped(bool is_primary) {
const LoginBigUserView* user = CurrentBigUserView();
// If the pod should not show an expanded view, tapping on it will launch
// Public Session immediately.
if (!user->GetCurrentUser()->public_account_info->show_expanded_view) {
std::string default_input_method;
for (const auto& keyboard :
user->GetCurrentUser()->public_account_info->keyboard_layouts) {
if (keyboard->selected) {
default_input_method = keyboard->ime_id;
break;
}
}
Shell::Get()->login_screen_controller()->LaunchPublicSession(
user->GetCurrentUser()->basic_user_info->account_id,
user->GetCurrentUser()->public_account_info->default_locale,
default_input_method);
return;
}
// Set the public account user to be the active user.
SwapActiveAuthBetweenPrimaryAndSecondary(is_primary);
......@@ -1547,7 +1566,7 @@ void LockContentsView::OnPublicAccountTapped(bool is_primary) {
// primary to secondary.
// 2. LoginUserInfo in the big user could be changed if we get updates from
// OnPublicSessionDisplayNameChanged and OnPublicSessionLocalesChanged.
expanded_view_->UpdateForUser(CurrentBigUserView()->GetCurrentUser());
expanded_view_->UpdateForUser(user->GetCurrentUser());
SetDisplayStyle(DisplayStyle::kExclusivePublicAccountExpandedView);
}
......
......@@ -71,6 +71,7 @@ mojom::LoginUserInfoPtr CreatePublicAccountUser(const std::string& email) {
user->basic_user_info->type = user_manager::USER_TYPE_PUBLIC_ACCOUNT;
user->public_account_info = ash::mojom::PublicAccountInfo::New();
user->public_account_info->enterprise_domain = email_parts[1];
user->public_account_info->show_expanded_view = true;
return user;
}
......
......@@ -123,6 +123,10 @@ struct PublicAccountInfo {
// Default locale for this user.
string default_locale;
// Show expanded user view that contains session information/warnings and
// locale selection.
bool show_expanded_view;
// Show the advanced expanded user view if there are at least two recommended
// locales. This will be the case in multilingual environments where users
// are likely to want to choose among locales.
......
......@@ -19,6 +19,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h"
#include "chrome/browser/chromeos/login/lock/screen_locker.h"
#include "chrome/browser/chromeos/login/lock_screen_utils.h"
......@@ -846,6 +847,9 @@ UserSelectionScreen::UpdateAndReturnUserListForMojo() {
std::move(available_locales));
user_info->public_account_info->default_locale = selected_locale;
user_info->public_account_info->show_advanced_view = has_multiple_locales;
// Do not show expanded view when in demo mode.
user_info->public_account_info->show_expanded_view =
!DemoSession::IsDeviceInDemoMode();
}
user_info->can_remove = CanRemoveUser(user);
......
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