| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/view.h" | 5 #include "ui/views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 887 |
| 888 View* View::GetPreviousFocusableView() { | 888 View* View::GetPreviousFocusableView() { |
| 889 return previous_focusable_view_; | 889 return previous_focusable_view_; |
| 890 } | 890 } |
| 891 | 891 |
| 892 void View::SetNextFocusableView(View* view) { | 892 void View::SetNextFocusableView(View* view) { |
| 893 view->previous_focusable_view_ = this; | 893 view->previous_focusable_view_ = this; |
| 894 next_focusable_view_ = view; | 894 next_focusable_view_ = view; |
| 895 } | 895 } |
| 896 | 896 |
| 897 bool View::IsFocusableInRootView() const { | 897 bool View::IsFocusable() const { |
| 898 return focusable_ && enabled_ && IsDrawn(); | 898 return focusable_ && enabled_ && IsDrawn(); |
| 899 } | 899 } |
| 900 | 900 |
| 901 bool View::IsAccessibilityFocusableInRootView() const { | 901 bool View::IsAccessibilityFocusableInRootView() const { |
| 902 return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); | 902 return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); |
| 903 } | 903 } |
| 904 | 904 |
| 905 FocusManager* View::GetFocusManager() { | 905 FocusManager* View::GetFocusManager() { |
| 906 Widget* widget = GetWidget(); | 906 Widget* widget = GetWidget(); |
| 907 return widget ? widget->GetFocusManager() : NULL; | 907 return widget ? widget->GetFocusManager() : NULL; |
| 908 } | 908 } |
| 909 | 909 |
| 910 const FocusManager* View::GetFocusManager() const { | 910 const FocusManager* View::GetFocusManager() const { |
| 911 const Widget* widget = GetWidget(); | 911 const Widget* widget = GetWidget(); |
| 912 return widget ? widget->GetFocusManager() : NULL; | 912 return widget ? widget->GetFocusManager() : NULL; |
| 913 } | 913 } |
| 914 | 914 |
| 915 void View::RequestFocus() { | 915 void View::RequestFocus() { |
| 916 FocusManager* focus_manager = GetFocusManager(); | 916 FocusManager* focus_manager = GetFocusManager(); |
| 917 if (focus_manager && IsFocusableInRootView()) | 917 if (focus_manager && IsFocusable()) |
| 918 focus_manager->SetFocusedView(this); | 918 focus_manager->SetFocusedView(this); |
| 919 } | 919 } |
| 920 | 920 |
| 921 bool View::SkipDefaultKeyEventProcessing(const KeyEvent& event) { | 921 bool View::SkipDefaultKeyEventProcessing(const KeyEvent& event) { |
| 922 return false; | 922 return false; |
| 923 } | 923 } |
| 924 | 924 |
| 925 FocusTraversable* View::GetFocusTraversable() { | 925 FocusTraversable* View::GetFocusTraversable() { |
| 926 return NULL; | 926 return NULL; |
| 927 } | 927 } |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 | 2038 |
| 2039 OSExchangeData data; | 2039 OSExchangeData data; |
| 2040 WriteDragData(press_pt, &data); | 2040 WriteDragData(press_pt, &data); |
| 2041 | 2041 |
| 2042 // Message the RootView to do the drag and drop. That way if we're removed | 2042 // Message the RootView to do the drag and drop. That way if we're removed |
| 2043 // the RootView can detect it and avoid calling us back. | 2043 // the RootView can detect it and avoid calling us back. |
| 2044 GetWidget()->RunShellDrag(this, data, drag_operations); | 2044 GetWidget()->RunShellDrag(this, data, drag_operations); |
| 2045 } | 2045 } |
| 2046 | 2046 |
| 2047 } // namespace views | 2047 } // namespace views |
| OLD | NEW |