Commit 371d6f0f authored by Alexander Hendrich's avatar Alexander Hendrich Committed by Commit Bot

Hide bottom status indicator when extension UI is visible

This CL adds the bottom status indicator depending on the
OobeDialogState. When the extension UI is visible, the bottom status
indicator will be hidden.


Bug: 1042944
Change-Id: I572c7c022ae0d58e1618a2e2e7cb9add37b036f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023657Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736001}
parent 276f7dc2
......@@ -22,6 +22,12 @@ namespace ash {
class BottomStatusIndicator : public views::View {
public:
enum class ContentType {
kNone,
kManagedDevice,
kAdbSideLoadingEnabled,
};
BottomStatusIndicator();
BottomStatusIndicator(const BottomStatusIndicator&) = delete;
......@@ -32,9 +38,16 @@ class BottomStatusIndicator : public views::View {
void SetIcon(const gfx::VectorIcon& vector_icon,
AshColorProvider::ContentLayerType type);
void set_content_type(ContentType content_type) {
content_type_ = content_type;
}
ContentType content_type() const { return content_type_; }
private:
views::Label* label_ = nullptr;
views::ImageView* icon_ = nullptr;
ContentType content_type_ = ContentType::kNone;
};
} // namespace ash
......
......@@ -620,7 +620,9 @@ void LockContentsView::ShowEntrepriseDomainName(
ui::GetChromeOSDeviceName(),
base::UTF8ToUTF16(entreprise_domain_name)),
gfx::kGoogleGrey200);
bottom_status_indicator_->SetVisible(true);
bottom_status_indicator_->set_content_type(
BottomStatusIndicator::ContentType::kManagedDevice);
UpdateBottomStatusIndicatorVisibility();
}
void LockContentsView::ShowAdbEnabled() {
......@@ -629,7 +631,9 @@ void LockContentsView::ShowAdbEnabled() {
bottom_status_indicator_->SetText(
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_SCREEN_UNVERIFIED_CODE_WARNING),
gfx::kGoogleRed300);
bottom_status_indicator_->SetVisible(true);
bottom_status_indicator_->set_content_type(
BottomStatusIndicator::ContentType::kAdbSideLoadingEnabled);
UpdateBottomStatusIndicatorVisibility();
}
void LockContentsView::ShowSystemInfo() {
......@@ -1259,10 +1263,13 @@ void LockContentsView::OnFocusLeavingLockScreenApps(bool reverse) {
void LockContentsView::OnOobeDialogStateChanged(OobeDialogState state) {
oobe_dialog_visible_ = state != OobeDialogState::HIDDEN;
extension_ui_visible_ = state == OobeDialogState::EXTENSION_LOGIN;
// Show either oobe dialog or lock screen.
SetVisible(!oobe_dialog_visible_);
UpdateBottomStatusIndicatorVisibility();
if (!oobe_dialog_visible_ && primary_big_view_)
primary_big_view_->RequestFocus();
}
......@@ -2184,4 +2191,14 @@ bool LockContentsView::GetSystemInfoVisibility() const {
}
}
void LockContentsView::UpdateBottomStatusIndicatorVisibility() {
bool visible =
bottom_status_indicator_->content_type() ==
BottomStatusIndicator::ContentType::kAdbSideLoadingEnabled ||
(bottom_status_indicator_->content_type() ==
BottomStatusIndicator::ContentType::kManagedDevice &&
!extension_ui_visible_);
bottom_status_indicator_->SetVisible(visible);
}
} // namespace ash
......@@ -376,6 +376,10 @@ class ASH_EXPORT LockContentsView
// factors including policy settings, channel and Alt-V accelerator.
bool GetSystemInfoVisibility() const;
// Toggles the visibility of the |bottom_status_indicator_| based on its
// content type and whether the extension UI window is opened.
void UpdateBottomStatusIndicatorVisibility();
const LockScreen::ScreenType screen_type_;
std::vector<UserState> users_;
......@@ -429,6 +433,9 @@ class ASH_EXPORT LockContentsView
// Bottom status indicator displaying entreprise domain or ADB enabled alert
BottomStatusIndicator* bottom_status_indicator_;
// Tracks the visibility of the extension Ui window.
bool extension_ui_visible_ = false;
int unlock_attempt_ = 0;
// Whether a lock screen app is currently active (i.e. lock screen note action
......
......@@ -811,6 +811,13 @@ TEST_F(LockContentsViewUnitTest, ShowStatusIndicatorIfAdbSideloadingEnabled) {
false /*show*/, false /*enforced*/, "Best version ever", "Asset ID: 6666",
"Bluetooth adapter", true /*adb_sideloading_enabled*/);
EXPECT_TRUE(test_api.bottom_status_indicator()->GetVisible());
// bottom_status_indicator should always be visible when displaying ADB
// sideloading warning.
DataDispatcher()->NotifyOobeDialogState(OobeDialogState::EXTENSION_LOGIN);
EXPECT_TRUE(test_api.bottom_status_indicator()->GetVisible());
DataDispatcher()->NotifyOobeDialogState(OobeDialogState::HIDDEN);
EXPECT_TRUE(test_api.bottom_status_indicator()->GetVisible());
}
// Show bottom status indicator if device is enrolled
......@@ -829,6 +836,13 @@ TEST_F(LockContentsViewUnitTest, ShowStatusIndicatorIfEnrolledDevice) {
LockContentsView::TestApi test_api(contents);
EXPECT_TRUE(test_api.bottom_status_indicator()->GetVisible());
// bottom_status_indicator should not be visible when displaying enterprise
// domain and extension UI is visible.
DataDispatcher()->NotifyOobeDialogState(OobeDialogState::EXTENSION_LOGIN);
EXPECT_FALSE(test_api.bottom_status_indicator()->GetVisible());
DataDispatcher()->NotifyOobeDialogState(OobeDialogState::HIDDEN);
EXPECT_TRUE(test_api.bottom_status_indicator()->GetVisible());
}
// Verifies the easy unlock tooltip is automatically displayed when requested.
......
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