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

Unified Diff: ui/views/focus/focus_manager.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made View::IsFocusable() non-virtual Created 6 years, 4 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
« no previous file with comments | « ui/views/focus/focus_manager.h ('k') | ui/views/view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager.cc
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
index 4808b4422cb1157310a4306bb74eb6c950fe1462..9347d35a05355fa20dc918d2c9f76288d0d86d6a 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -357,6 +357,20 @@ void FocusManager::ClearFocus() {
SetStoredFocusView(focused_view);
}
+void FocusManager::AdvanceFocusIfNecessary() {
+ if (widget_->IsActive()) {
sky 2014/08/08 14:52:30 nit: I would early out if !active. Less indentatio
mohsen 2014/08/08 17:45:07 Done.
+ // If widget is active and focused view is not focusable, advance focus or,
+ // if not possible, clear focus.
+ if (focused_view_ && !focused_view_->IsAccessibilityFocusable()) {
+ AdvanceFocus(false);
+ if (focused_view_ && !focused_view_->IsAccessibilityFocusable())
+ ClearFocus();
+ }
+ }
+ // If widget is inactive, there is no focused view to check. The stored view
+ // will also be checked for focusability when it is being restored.
+}
+
void FocusManager::StoreFocusedView(bool clear_native_focus) {
View* focused_view = focused_view_;
// Don't do anything if no focused view. Storing the view (which is NULL), in
« no previous file with comments | « ui/views/focus/focus_manager.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698