| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 keyboard_accessible_ = keyboard_accessible; | 294 keyboard_accessible_ = keyboard_accessible; |
| 295 // Disabling keyboard accessibility may cause the focused view to become not | 295 // Disabling keyboard accessibility may cause the focused view to become not |
| 296 // focusable. Hence advance focus if necessary. | 296 // focusable. Hence advance focus if necessary. |
| 297 AdvanceFocusIfNecessary(); | 297 AdvanceFocusIfNecessary(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void FocusManager::SetFocusedViewWithReason( | 300 void FocusManager::SetFocusedViewWithReason( |
| 301 View* view, FocusChangeReason reason) { | 301 View* view, FocusChangeReason reason) { |
| 302 if (focused_view_ == view) | 302 if (focused_view_ == view) |
| 303 return; | 303 return; |
| 304 // TODO(oshima|achuith): This is to diagnose crbug.com/687232. |
| 305 // Change this to DCHECK once it's resolved. |
| 306 CHECK(!view || ContainsView(view)); |
| 304 | 307 |
| 305 #if !defined(OS_MACOSX) | 308 #if !defined(OS_MACOSX) |
| 306 // TODO(warx): There are some AccessiblePaneViewTest failed on macosx. | 309 // TODO(warx): There are some AccessiblePaneViewTest failed on macosx. |
| 307 // crbug.com/650859. Remove !defined(OS_MACOSX) once that is fixed. | 310 // crbug.com/650859. Remove !defined(OS_MACOSX) once that is fixed. |
| 308 // | 311 // |
| 309 // If the widget isn't active store the focused view and then attempt to | 312 // If the widget isn't active store the focused view and then attempt to |
| 310 // activate the widget. If activation succeeds |view| will be focused. | 313 // activate the widget. If activation succeeds |view| will be focused. |
| 311 // If activation fails |view| will be focused the next time the widget is | 314 // If activation fails |view| will be focused the next time the widget is |
| 312 // made active. | 315 // made active. |
| 313 if (view && !widget_->IsActive()) { | 316 if (view && !widget_->IsActive()) { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 // |keyboard_accessible_| is only used on Mac. | 559 // |keyboard_accessible_| is only used on Mac. |
| 557 #if defined(OS_MACOSX) | 560 #if defined(OS_MACOSX) |
| 558 return keyboard_accessible_ ? view->IsAccessibilityFocusable() | 561 return keyboard_accessible_ ? view->IsAccessibilityFocusable() |
| 559 : view->IsFocusable(); | 562 : view->IsFocusable(); |
| 560 #else | 563 #else |
| 561 return view->IsAccessibilityFocusable(); | 564 return view->IsAccessibilityFocusable(); |
| 562 #endif | 565 #endif |
| 563 } | 566 } |
| 564 | 567 |
| 565 } // namespace views | 568 } // namespace views |
| OLD | NEW |