Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 2517663002: Fix unable to delete extensions continuously through keyboard (Closed)
Patch Set: based on comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 671fcd17549476ce419c80c280205ed09c10ceed..cc4f0165bb4822280b93d120517e82d72bdfa4cc 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -243,6 +243,7 @@ DesktopNativeWidgetAura::DesktopNativeWidgetAura(
content_window_(new aura::Window(this)),
native_widget_delegate_(delegate),
last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
+ restore_focus_on_activate_(false),
cursor_(gfx::kNullCursor),
widget_type_(Widget::InitParams::TYPE_WINDOW),
close_widget_factory_(this) {
@@ -361,8 +362,13 @@ void DesktopNativeWidgetAura::HandleActivationChanged(bool active) {
: focus_manager->GetStoredFocusView();
if (!view_for_activation)
view_for_activation = GetWidget()->GetRootView();
- else if (view_for_activation == focus_manager->GetStoredFocusView())
+ else if (view_for_activation == focus_manager->GetStoredFocusView()) {
sky 2016/11/21 22:21:40 When you add parens to one branch of a conditional
focus_manager->RestoreFocusedView();
+ // Set to false if desktop native widget has activated activation
+ // change, so that aura window activation change focus restore operation
+ // can be ignored.
+ restore_focus_on_activate_ = false;
+ }
activation_client->ActivateWindow(
view_for_activation->GetWidget()->GetNativeView());
// Refreshes the focus info to IMF in case that IMF cached the old info
@@ -1088,7 +1094,16 @@ void DesktopNativeWidgetAura::OnWindowActivated(
aura::Window* gained_active,
aura::Window* lost_active) {
DCHECK(content_window_ == gained_active || content_window_ == lost_active);
- if (lost_active == content_window_ && GetWidget()->HasFocusManager()) {
+ if (gained_active == content_window_ && restore_focus_on_activate_) {
+ restore_focus_on_activate_ = false;
sky 2016/11/21 16:19:08 I'm still confused as to why we need logic here? I
Qiang(Joe) Xu 2016/11/21 19:25:10 HandleActivationChanged is not always called. It i
+ // For OS_LINUX, desktop native widget may not be activated when child
+ // widgets gets aura activation changes. Only when desktop native widget is
+ // active, we can rely on aura activation to restore focused view.
+ if (GetWidget()->IsActive())
+ GetWidget()->GetFocusManager()->RestoreFocusedView();
+ } else if (lost_active == content_window_ && GetWidget()->HasFocusManager()) {
+ DCHECK(!restore_focus_on_activate_);
+ restore_focus_on_activate_ = true;
// Pass in false so that ClearNativeFocus() isn't invoked.
GetWidget()->GetFocusManager()->StoreFocusedView(false);
}
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698