Commit 9edb615f authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Unified: Fix FirstRunUIBrowserTest.

It fixes FirstRunUIBrowserTest when UnifiedSystemTray is enabled.

The test is regressed by interactive_ui_tests fix
https://crrev.com/c/1096718. We only have to set initial focus when
system tray bubble is activated.

This is a flag flip blocker of
chrome://flags/#enable-system-tray-unified.

TEST=FirstRunUIBrowserTest.EscapeCancelsTutorial
BUG=847104

Change-Id: Iccb8ea92724fffc787a649e1a4fdac36507f3b71
Reviewed-on: https://chromium-review.googlesource.com/1098419
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566718}
parent 8f14a9d0
...@@ -45,12 +45,12 @@ UnifiedSystemTrayBubble::UnifiedSystemTrayBubble(UnifiedSystemTray* tray, ...@@ -45,12 +45,12 @@ UnifiedSystemTrayBubble::UnifiedSystemTrayBubble(UnifiedSystemTray* tray,
int max_height = tray->shelf()->GetUserWorkAreaBounds().height() - int max_height = tray->shelf()->GetUserWorkAreaBounds().height() -
kPaddingFromScreenTop - kPaddingFromScreenTop -
bubble_view_->GetBorderInsets().height(); bubble_view_->GetBorderInsets().height();
auto* unified_view = controller_->CreateView(); unified_view_ = controller_->CreateView();
time_to_click_recorder_ = time_to_click_recorder_ =
std::make_unique<TimeToClickRecorder>(this, unified_view); std::make_unique<TimeToClickRecorder>(this, unified_view_);
unified_view->SetMaxHeight(max_height); unified_view_->SetMaxHeight(max_height);
bubble_view_->SetMaxHeight(max_height); bubble_view_->SetMaxHeight(max_height);
bubble_view_->AddChildView(unified_view); bubble_view_->AddChildView(unified_view_);
bubble_view_->set_anchor_view_insets( bubble_view_->set_anchor_view_insets(
tray->shelf()->GetSystemTrayAnchor()->GetBubbleAnchorInsets()); tray->shelf()->GetSystemTrayAnchor()->GetBubbleAnchorInsets());
bubble_view_->set_color(SK_ColorTRANSPARENT); bubble_view_->set_color(SK_ColorTRANSPARENT);
...@@ -67,8 +67,6 @@ UnifiedSystemTrayBubble::UnifiedSystemTrayBubble(UnifiedSystemTray* tray, ...@@ -67,8 +67,6 @@ UnifiedSystemTrayBubble::UnifiedSystemTrayBubble(UnifiedSystemTray* tray,
kUnifiedMenuBackgroundBlur); kUnifiedMenuBackgroundBlur);
} }
unified_view->RequestInitFocus();
tray->tray_event_filter()->AddBubble(this); tray->tray_event_filter()->AddBubble(this);
} }
...@@ -90,7 +88,9 @@ bool UnifiedSystemTrayBubble::IsBubbleActive() const { ...@@ -90,7 +88,9 @@ bool UnifiedSystemTrayBubble::IsBubbleActive() const {
} }
void UnifiedSystemTrayBubble::ActivateBubble() { void UnifiedSystemTrayBubble::ActivateBubble() {
DCHECK(unified_view_);
DCHECK(bubble_widget_); DCHECK(bubble_widget_);
unified_view_->RequestInitFocus();
bubble_widget_->widget_delegate()->set_can_activate(true); bubble_widget_->widget_delegate()->set_can_activate(true);
bubble_widget_->Activate(); bubble_widget_->Activate();
} }
......
...@@ -22,6 +22,7 @@ namespace ash { ...@@ -22,6 +22,7 @@ namespace ash {
class UnifiedSystemTray; class UnifiedSystemTray;
class UnifiedSystemTrayController; class UnifiedSystemTrayController;
class UnifiedSystemTrayView;
// Manages the bubble that contains UnifiedSystemTrayView. // Manages the bubble that contains UnifiedSystemTrayView.
// Shows the bubble on the constructor, and closes the bubble on the destructor. // Shows the bubble on the constructor, and closes the bubble on the destructor.
...@@ -82,6 +83,7 @@ class UnifiedSystemTrayBubble : public TrayBubbleBase, ...@@ -82,6 +83,7 @@ class UnifiedSystemTrayBubble : public TrayBubbleBase,
base::Optional<base::TimeTicks> time_shown_by_click_; base::Optional<base::TimeTicks> time_shown_by_click_;
views::TrayBubbleView* bubble_view_ = nullptr; views::TrayBubbleView* bubble_view_ = nullptr;
UnifiedSystemTrayView* unified_view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(UnifiedSystemTrayBubble); DISALLOW_COPY_AND_ASSIGN(UnifiedSystemTrayBubble);
}; };
......
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