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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 void FocusManager::ClearFocus() { | 347 void FocusManager::ClearFocus() { |
348 // SetFocusedView(NULL) is going to clear out the stored view to. We need to | 348 // SetFocusedView(NULL) is going to clear out the stored view to. We need to |
349 // persist it in this case. | 349 // persist it in this case. |
350 views::View* focused_view = GetStoredFocusView(); | 350 views::View* focused_view = GetStoredFocusView(); |
351 SetFocusedView(NULL); | 351 SetFocusedView(NULL); |
352 ClearNativeFocus(); | 352 ClearNativeFocus(); |
353 SetStoredFocusView(focused_view); | 353 SetStoredFocusView(focused_view); |
354 } | 354 } |
355 | 355 |
| 356 void FocusManager::ReviseFocusedView() { |
| 357 if (focused_view_ && !focused_view_->IsAccessibilityFocusable()) { |
| 358 AdvanceFocus(false); |
| 359 if (focused_view_ && !focused_view_->IsAccessibilityFocusable()) |
| 360 ClearFocus(); |
| 361 } |
| 362 } |
| 363 |
356 void FocusManager::StoreFocusedView(bool clear_native_focus) { | 364 void FocusManager::StoreFocusedView(bool clear_native_focus) { |
357 View* focused_view = focused_view_; | 365 View* focused_view = focused_view_; |
358 // Don't do anything if no focused view. Storing the view (which is NULL), in | 366 // Don't do anything if no focused view. Storing the view (which is NULL), in |
359 // this case, would clobber the view that was previously saved. | 367 // this case, would clobber the view that was previously saved. |
360 if (!focused_view_) | 368 if (!focused_view_) |
361 return; | 369 return; |
362 | 370 |
363 View* v = focused_view_; | 371 View* v = focused_view_; |
364 | 372 |
365 if (clear_native_focus) { | 373 if (clear_native_focus) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 549 } |
542 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 550 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
543 AdvanceFocus(false); | 551 AdvanceFocus(false); |
544 return true; | 552 return true; |
545 } | 553 } |
546 | 554 |
547 return false; | 555 return false; |
548 } | 556 } |
549 | 557 |
550 } // namespace views | 558 } // namespace views |
OLD | NEW |