| 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 25 matching lines...) Expand all Loading... |
| 36 shortcut_handling_suspended_(false), | 36 shortcut_handling_suspended_(false), |
| 37 focus_change_reason_(kReasonDirectFocusChange), | 37 focus_change_reason_(kReasonDirectFocusChange), |
| 38 is_changing_focus_(false), | 38 is_changing_focus_(false), |
| 39 keyboard_accessible_(false) { | 39 keyboard_accessible_(false) { |
| 40 DCHECK(widget_); | 40 DCHECK(widget_); |
| 41 stored_focused_view_storage_id_ = | 41 stored_focused_view_storage_id_ = |
| 42 ViewStorage::GetInstance()->CreateStorageID(); | 42 ViewStorage::GetInstance()->CreateStorageID(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 FocusManager::~FocusManager() { | 45 FocusManager::~FocusManager() { |
| 46 for (FocusChangeListener& observer : focus_change_listeners_) |
| 47 observer.OnFocusManagerDestroying(); |
| 46 } | 48 } |
| 47 | 49 |
| 48 bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) { | 50 bool FocusManager::OnKeyEvent(const ui::KeyEvent& event) { |
| 49 const int key_code = event.key_code(); | 51 const int key_code = event.key_code(); |
| 50 | 52 |
| 51 if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED) | 53 if (event.type() != ui::ET_KEY_PRESSED && event.type() != ui::ET_KEY_RELEASED) |
| 52 return false; | 54 return false; |
| 53 | 55 |
| 54 if (shortcut_handling_suspended()) | 56 if (shortcut_handling_suspended()) |
| 55 return true; | 57 return true; |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 // |keyboard_accessible_| is only used on Mac. | 570 // |keyboard_accessible_| is only used on Mac. |
| 569 #if defined(OS_MACOSX) | 571 #if defined(OS_MACOSX) |
| 570 return keyboard_accessible_ ? view->IsAccessibilityFocusable() | 572 return keyboard_accessible_ ? view->IsAccessibilityFocusable() |
| 571 : view->IsFocusable(); | 573 : view->IsFocusable(); |
| 572 #else | 574 #else |
| 573 return view->IsAccessibilityFocusable(); | 575 return view->IsAccessibilityFocusable(); |
| 574 #endif | 576 #endif |
| 575 } | 577 } |
| 576 | 578 |
| 577 } // namespace views | 579 } // namespace views |
| OLD | NEW |