| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/focus/focus_manager.h" | 5 #include "ui/views/focus/focus_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 ViewStorage* view_storage = ViewStorage::GetInstance(); | 290 ViewStorage* view_storage = ViewStorage::GetInstance(); |
| 291 if (!view_storage) { | 291 if (!view_storage) { |
| 292 // This should never happen but bug 981648 seems to indicate it could. | 292 // This should never happen but bug 981648 seems to indicate it could. |
| 293 NOTREACHED(); | 293 NOTREACHED(); |
| 294 return; | 294 return; |
| 295 } | 295 } |
| 296 | 296 |
| 297 View* view = view_storage->RetrieveView(stored_focused_view_storage_id_); | 297 View* view = view_storage->RetrieveView(stored_focused_view_storage_id_); |
| 298 if (view) { | 298 if (view) { |
| 299 if (ContainsView(view)) { | 299 if (ContainsView(view)) { |
| 300 if (!view->IsFocusable() && view->IsAccessibilityFocusableInRootView()) { | 300 if (!view->IsFocusable() && view->IsAccessibilityFocusable()) { |
| 301 // RequestFocus would fail, but we want to restore focus to controls | 301 // RequestFocus would fail, but we want to restore focus to controls |
| 302 // that had focus in accessibility mode. | 302 // that had focus in accessibility mode. |
| 303 SetFocusedViewWithReason(view, kReasonFocusRestore); | 303 SetFocusedViewWithReason(view, kReasonFocusRestore); |
| 304 } else { | 304 } else { |
| 305 // This usually just sets the focus if this view is focusable, but | 305 // This usually just sets the focus if this view is focusable, but |
| 306 // let the view override RequestFocus if necessary. | 306 // let the view override RequestFocus if necessary. |
| 307 view->RequestFocus(); | 307 view->RequestFocus(); |
| 308 | 308 |
| 309 // If it succeeded, the reason would be incorrect; set it to | 309 // If it succeeded, the reason would be incorrect; set it to |
| 310 // focus restore. | 310 // focus restore. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { | 400 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { |
| 401 focus_change_listeners_.AddObserver(listener); | 401 focus_change_listeners_.AddObserver(listener); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { | 404 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { |
| 405 focus_change_listeners_.RemoveObserver(listener); | 405 focus_change_listeners_.RemoveObserver(listener); |
| 406 } | 406 } |
| 407 | 407 |
| 408 } // namespace views | 408 } // namespace views |
| OLD | NEW |