Chromium Code Reviews| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 if (widget->widget_delegate()->ShouldAdvanceFocusToTopLevelWidget()) | 306 if (widget->widget_delegate()->ShouldAdvanceFocusToTopLevelWidget()) |
| 307 widget = widget_; | 307 widget = widget_; |
| 308 return GetNextFocusableView(NULL, widget, reverse, true); | 308 return GetNextFocusableView(NULL, widget, reverse, true); |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 return NULL; | 311 return NULL; |
| 312 } | 312 } |
| 313 | 313 |
| 314 void FocusManager::SetFocusedViewWithReason( | 314 void FocusManager::SetFocusedViewWithReason( |
| 315 View* view, FocusChangeReason reason) { | 315 View* view, FocusChangeReason reason) { |
| 316 if (focused_view_ == view) | 316 if (focused_view_ == view) { |
| 317 // In the case that the widget lost the focus and gained it back without | |
| 318 // changing the focused view, we have to make the text input client focused. | |
| 319 FocusTextInputClient(focused_view_); | |
|
sky
2014/05/27 17:05:44
We also can end up here if View::RequestFocus() is
Yuki
2014/05/28 15:02:43
No, nothing bad happen.
If the widget is active,
| |
| 317 return; | 320 return; |
| 321 } | |
| 318 | 322 |
| 319 base::AutoReset<bool> auto_changing_focus(&is_changing_focus_, true); | 323 base::AutoReset<bool> auto_changing_focus(&is_changing_focus_, true); |
| 320 // Update the reason for the focus change (since this is checked by | 324 // Update the reason for the focus change (since this is checked by |
| 321 // some listeners), then notify all listeners. | 325 // some listeners), then notify all listeners. |
| 322 focus_change_reason_ = reason; | 326 focus_change_reason_ = reason; |
| 323 FOR_EACH_OBSERVER(FocusChangeListener, focus_change_listeners_, | 327 FOR_EACH_OBSERVER(FocusChangeListener, focus_change_listeners_, |
| 324 OnWillChangeFocus(focused_view_, view)); | 328 OnWillChangeFocus(focused_view_, view)); |
| 325 | 329 |
| 326 View* old_focused_view = focused_view_; | 330 View* old_focused_view = focused_view_; |
| 327 focused_view_ = view; | 331 focused_view_ = view; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 } | 583 } |
| 580 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 584 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
| 581 AdvanceFocus(false); | 585 AdvanceFocus(false); |
| 582 return true; | 586 return true; |
| 583 } | 587 } |
| 584 | 588 |
| 585 return false; | 589 return false; |
| 586 } | 590 } |
| 587 | 591 |
| 588 } // namespace views | 592 } // namespace views |
| OLD | NEW |