| 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 6 | 6 |
| 7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 bool child = widget && widget->GetTopLevelWidget() != widget; | 1161 bool child = widget && widget->GetTopLevelWidget() != widget; |
| 1162 bool focus_in_child = | 1162 bool focus_in_child = |
| 1163 widget && | 1163 widget && |
| 1164 widget->GetRootView()->Contains(GetFocusManager()->GetFocusedView()); | 1164 widget->GetRootView()->Contains(GetFocusManager()->GetFocusedView()); |
| 1165 if ((child && !focus_in_child) || (!child && !widget->IsActive())) | 1165 if ((child && !focus_in_child) || (!child && !widget->IsActive())) |
| 1166 return false; | 1166 return false; |
| 1167 #endif | 1167 #endif |
| 1168 return true; | 1168 return true; |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 bool View::HandlesAccelerator(const ui::Accelerator& accelerator) { |
| 1172 return CanHandleAccelerators() && accelerators_ && |
| 1173 std::find(accelerators_->begin(), accelerators_->end(), accelerator) != |
| 1174 accelerators_->end(); |
| 1175 } |
| 1176 |
| 1171 // Focus ----------------------------------------------------------------------- | 1177 // Focus ----------------------------------------------------------------------- |
| 1172 | 1178 |
| 1173 bool View::HasFocus() const { | 1179 bool View::HasFocus() const { |
| 1174 const FocusManager* focus_manager = GetFocusManager(); | 1180 const FocusManager* focus_manager = GetFocusManager(); |
| 1175 return focus_manager && (focus_manager->GetFocusedView() == this); | 1181 return focus_manager && (focus_manager->GetFocusedView() == this); |
| 1176 } | 1182 } |
| 1177 | 1183 |
| 1178 View* View::GetNextFocusableView() { | 1184 View* View::GetNextFocusableView() { |
| 1179 return next_focusable_view_; | 1185 return next_focusable_view_; |
| 1180 } | 1186 } |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 // Message the RootView to do the drag and drop. That way if we're removed | 2432 // Message the RootView to do the drag and drop. That way if we're removed |
| 2427 // the RootView can detect it and avoid calling us back. | 2433 // the RootView can detect it and avoid calling us back. |
| 2428 gfx::Point widget_location(event.location()); | 2434 gfx::Point widget_location(event.location()); |
| 2429 ConvertPointToWidget(this, &widget_location); | 2435 ConvertPointToWidget(this, &widget_location); |
| 2430 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2436 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2431 // WARNING: we may have been deleted. | 2437 // WARNING: we may have been deleted. |
| 2432 return true; | 2438 return true; |
| 2433 } | 2439 } |
| 2434 | 2440 |
| 2435 } // namespace views | 2441 } // namespace views |
| OLD | NEW |