| 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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 Widget* widget = GetWidget(); | 1296 Widget* widget = GetWidget(); |
| 1297 return widget ? widget->GetFocusManager() : NULL; | 1297 return widget ? widget->GetFocusManager() : NULL; |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 const FocusManager* View::GetFocusManager() const { | 1300 const FocusManager* View::GetFocusManager() const { |
| 1301 const Widget* widget = GetWidget(); | 1301 const Widget* widget = GetWidget(); |
| 1302 return widget ? widget->GetFocusManager() : NULL; | 1302 return widget ? widget->GetFocusManager() : NULL; |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 void View::RequestFocus() { | 1305 void View::RequestFocus() { |
| 1306 LOG(ERROR) << "request focus!!!"; |
| 1306 FocusManager* focus_manager = GetFocusManager(); | 1307 FocusManager* focus_manager = GetFocusManager(); |
| 1307 if (focus_manager) { | 1308 if (focus_manager) { |
| 1309 LOG(ERROR) << "inside!"; |
| 1308 bool focusable = focus_manager->keyboard_accessible() | 1310 bool focusable = focus_manager->keyboard_accessible() |
| 1309 ? IsAccessibilityFocusable() | 1311 ? IsAccessibilityFocusable() |
| 1310 : IsFocusable(); | 1312 : IsFocusable(); |
| 1311 if (focusable) | 1313 if (focusable) { |
| 1314 LOG(ERROR) << "can focus!!!!"; |
| 1312 focus_manager->SetFocusedView(this); | 1315 focus_manager->SetFocusedView(this); |
| 1316 } |
| 1313 } | 1317 } |
| 1314 } | 1318 } |
| 1315 | 1319 |
| 1316 bool View::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { | 1320 bool View::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { |
| 1317 return false; | 1321 return false; |
| 1318 } | 1322 } |
| 1319 | 1323 |
| 1320 FocusTraversable* View::GetFocusTraversable() { | 1324 FocusTraversable* View::GetFocusTraversable() { |
| 1321 return NULL; | 1325 return NULL; |
| 1322 } | 1326 } |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 // Message the RootView to do the drag and drop. That way if we're removed | 2648 // Message the RootView to do the drag and drop. That way if we're removed |
| 2645 // the RootView can detect it and avoid calling us back. | 2649 // the RootView can detect it and avoid calling us back. |
| 2646 gfx::Point widget_location(event.location()); | 2650 gfx::Point widget_location(event.location()); |
| 2647 ConvertPointToWidget(this, &widget_location); | 2651 ConvertPointToWidget(this, &widget_location); |
| 2648 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2652 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2649 // WARNING: we may have been deleted. | 2653 // WARNING: we may have been deleted. |
| 2650 return true; | 2654 return true; |
| 2651 } | 2655 } |
| 2652 | 2656 |
| 2653 } // namespace views | 2657 } // namespace views |
| OLD | NEW |