Commit 29fa932b authored by Quan Nguyen's avatar Quan Nguyen Committed by Commit Bot

cros: Ensure login bubbles are clickable when overlapping with shelf and virtual keyboard

Bug: 884668
Change-Id: I16dd2c5b0156bf1490b57acd4185c1d80d193a67
Reviewed-on: https://chromium-review.googlesource.com/c/1330206Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Quan Nguyen <qnnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607771}
parent ad21cca2
......@@ -26,6 +26,10 @@ constexpr int kBubbleBottomMarginDp = 18;
} // namespace
LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view)
: LoginBaseBubbleView(anchor_view, nullptr) {}
LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view,
aura::Window* parent_window)
: BubbleDialogDelegateView(anchor_view, views::BubbleBorder::NONE) {
set_margins(gfx::Insets(kBubbleTopMarginDp, kBubbleHorizontalMarginDp,
kBubbleBottomMarginDp, kBubbleHorizontalMarginDp));
......@@ -36,6 +40,8 @@ LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view)
// Layer rendering is needed for animation.
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
set_parent_window(parent_window);
}
LoginBaseBubbleView::~LoginBaseBubbleView() = default;
......@@ -43,15 +49,13 @@ LoginBaseBubbleView::~LoginBaseBubbleView() = default;
void LoginBaseBubbleView::OnBeforeBubbleWidgetInit(
views::Widget::InitParams* params,
views::Widget* widget) const {
// Login bubbles must always be associated with the lock screen container,
// otherwise they may not show up as other containers are hidden.
//
// params->parent may be already set if the bubble has an anchor view.
// Shell may be null in tests.
// This case only gets called if the bubble has no anchor and no parent
// container was specified. In this case, the parent container should default
// to MenuContainer, so that login bubbles are visible over the shelf and
// virtual keyboard. Shell may be null in tests.
if (!params->parent && Shell::HasInstance()) {
params->parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(),
kShellWindowId_LockScreenContainer);
kShellWindowId_MenuContainer);
}
}
......
......@@ -14,7 +14,11 @@ namespace ash {
// Base bubble view for login screen bubbles.
class ASH_EXPORT LoginBaseBubbleView : public views::BubbleDialogDelegateView {
public:
// Without specifying a parent_window, the bubble will default to being in the
// same container as anchor_view.
explicit LoginBaseBubbleView(views::View* anchor_view);
explicit LoginBaseBubbleView(views::View* anchor_view,
gfx::NativeView parent_window);
~LoginBaseBubbleView() override;
// views::BubbleDialogDelegateView:
......
......@@ -15,6 +15,7 @@
#include "ash/login/ui/non_accessible_view.h"
#include "ash/login/ui/views_utils.h"
#include "ash/public/cpp/ash_constants.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
......@@ -93,8 +94,10 @@ views::Label* CreateLabel(const base::string16& message, SkColor color) {
class LoginErrorBubbleView : public LoginBaseBubbleView {
public:
LoginErrorBubbleView(views::View* content, views::View* anchor_view)
: LoginBaseBubbleView(anchor_view) {
LoginErrorBubbleView(views::View* content,
views::View* anchor_view,
aura::Window* container)
: LoginBaseBubbleView(anchor_view, container) {
set_anchor_view_insets(
gfx::Insets(kAnchorViewErrorBubbleVerticalSpacingDp, 0));
......@@ -445,7 +448,9 @@ void LoginBubble::ShowErrorBubble(views::View* content,
CloseImmediately();
flags_ = flags;
bubble_view_ = new LoginErrorBubbleView(content, anchor_view);
aura::Window* menu_container = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_MenuContainer);
bubble_view_ = new LoginErrorBubbleView(content, anchor_view, menu_container);
Show();
}
......
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