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

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

Issue 11885030: Enable the FocusController on DesktopAura too. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months 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
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
===================================================================
--- ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (revision 180150)
+++ ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (working copy)
@@ -16,6 +16,7 @@
#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/corewm/compound_event_filter.h"
+#include "ui/views/corewm/corewm_switches.h"
#include "ui/views/corewm/input_method_event_filter.h"
#include "ui/views/drag_utils.h"
#include "ui/views/ime/input_method.h"
@@ -437,7 +438,7 @@
void DesktopNativeWidgetAura::ClearNativeFocus() {
desktop_root_window_host_->ClearNativeFocus();
- aura::client::GetFocusClient(window_)->FocusWindow(window_);
+ aura::client::GetFocusClient(window_)->ResetFocusWithinActiveWindow(window_);
}
gfx::Rect DesktopNativeWidgetAura::GetWorkAreaBoundsInScreen() const {
@@ -632,23 +633,28 @@
restore_focus_on_activate_ = false;
GetWidget()->GetFocusManager()->RestoreFocusedView();
} else if (lost_active == window_ && GetWidget()->HasFocusManager()) {
- // If we're losing focus to a window that is a top level (such as a bubble)
- // store the focus. Such a window shares the same RootWindowHost, so that
- // such a change won't trigger an activation change (which calls
- // StoreFocusedView()). Without this the focused view is never told it lost
- // focus.
- aura::Window* focused_window =
+ bool store_focused_view = corewm::UseFocusControllerOnDesktop();
+ if (!store_focused_view) {
+ // If we're losing focus to a window that is a top level (such as a
+ // bubble) store the focus. Such a window shares the same
+ // RootWindowHost, so that such a change won't trigger an activation
+ // change (which calls StoreFocusedView()). Without this the focused
+ // view is never told it lost focus.
+ aura::Window* focused_window =
aura::client::GetFocusClient(window_)->GetFocusedWindow();
- if (focused_window && focused_window != window_) {
- Widget* focused_widget = Widget::GetWidgetForNativeWindow(focused_window);
- if (focused_widget && focused_widget != GetWidget() &&
- focused_widget->is_top_level()) {
- DCHECK(!restore_focus_on_activate_);
- restore_focus_on_activate_ = true;
- // Pass in false so that ClearNativeFocus() isn't invoked.
- GetWidget()->GetFocusManager()->StoreFocusedView(false);
+ if (focused_window && focused_window != window_) {
+ Widget* focused_widget =
+ Widget::GetWidgetForNativeWindow(focused_window);
+ store_focused_view = focused_widget && focused_widget != GetWidget() &&
+ focused_widget->is_top_level();
}
}
+ if (store_focused_view) {
+ 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_focus_rules.cc ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698