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::ClearFocusIfUnfocusable() { | |
sky
2013/12/11 21:29:29
Why is this clearing and not advancing? Also, I th
mohsen
2013/12/12 18:26:54
1. About clearing vs advancing, as I stated in my
| |
357 if (focused_view_ && !focused_view_->IsAccessibilityFocusable()) | |
358 ClearFocus(); | |
359 } | |
360 | |
356 void FocusManager::StoreFocusedView(bool clear_native_focus) { | 361 void FocusManager::StoreFocusedView(bool clear_native_focus) { |
357 View* focused_view = focused_view_; | 362 View* focused_view = focused_view_; |
358 // Don't do anything if no focused view. Storing the view (which is NULL), in | 363 // 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. | 364 // this case, would clobber the view that was previously saved. |
360 if (!focused_view_) | 365 if (!focused_view_) |
361 return; | 366 return; |
362 | 367 |
363 View* v = focused_view_; | 368 View* v = focused_view_; |
364 | 369 |
365 if (clear_native_focus) { | 370 if (clear_native_focus) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
541 } | 546 } |
542 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 547 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
543 AdvanceFocus(false); | 548 AdvanceFocus(false); |
544 return true; | 549 return true; |
545 } | 550 } |
546 | 551 |
547 return false; | 552 return false; |
548 } | 553 } |
549 | 554 |
550 } // namespace views | 555 } // namespace views |
OLD | NEW |