| 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 19 matching lines...) Expand all Loading... |
| 30 #include "ui/gfx/point_conversions.h" | 30 #include "ui/gfx/point_conversions.h" |
| 31 #include "ui/gfx/rect_conversions.h" | 31 #include "ui/gfx/rect_conversions.h" |
| 32 #include "ui/gfx/screen.h" | 32 #include "ui/gfx/screen.h" |
| 33 #include "ui/gfx/skia_util.h" | 33 #include "ui/gfx/skia_util.h" |
| 34 #include "ui/gfx/transform.h" | 34 #include "ui/gfx/transform.h" |
| 35 #include "ui/native_theme/native_theme.h" | 35 #include "ui/native_theme/native_theme.h" |
| 36 #include "ui/views/accessibility/native_view_accessibility.h" | 36 #include "ui/views/accessibility/native_view_accessibility.h" |
| 37 #include "ui/views/background.h" | 37 #include "ui/views/background.h" |
| 38 #include "ui/views/context_menu_controller.h" | 38 #include "ui/views/context_menu_controller.h" |
| 39 #include "ui/views/drag_controller.h" | 39 #include "ui/views/drag_controller.h" |
| 40 #include "ui/views/ime/input_method.h" |
| 40 #include "ui/views/layout/layout_manager.h" | 41 #include "ui/views/layout/layout_manager.h" |
| 41 #include "ui/views/views_delegate.h" | 42 #include "ui/views/views_delegate.h" |
| 42 #include "ui/views/widget/native_widget_private.h" | 43 #include "ui/views/widget/native_widget_private.h" |
| 43 #include "ui/views/widget/root_view.h" | 44 #include "ui/views/widget/root_view.h" |
| 44 #include "ui/views/widget/tooltip_manager.h" | 45 #include "ui/views/widget/tooltip_manager.h" |
| 45 #include "ui/views/widget/widget.h" | 46 #include "ui/views/widget/widget.h" |
| 46 | 47 |
| 47 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 48 #include "base/win/scoped_gdi_object.h" | 49 #include "base/win/scoped_gdi_object.h" |
| 49 #endif | 50 #endif |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 | 1537 |
| 1537 void View::OnFocus() { | 1538 void View::OnFocus() { |
| 1538 // TODO(beng): Investigate whether it's possible for us to move this to | 1539 // TODO(beng): Investigate whether it's possible for us to move this to |
| 1539 // Focus(). | 1540 // Focus(). |
| 1540 // By default, we clear the native focus. This ensures that no visible native | 1541 // By default, we clear the native focus. This ensures that no visible native |
| 1541 // view as the focus and that we still receive keyboard inputs. | 1542 // view as the focus and that we still receive keyboard inputs. |
| 1542 FocusManager* focus_manager = GetFocusManager(); | 1543 FocusManager* focus_manager = GetFocusManager(); |
| 1543 if (focus_manager) | 1544 if (focus_manager) |
| 1544 focus_manager->ClearNativeFocus(); | 1545 focus_manager->ClearNativeFocus(); |
| 1545 | 1546 |
| 1547 if (GetInputMethod()) |
| 1548 GetInputMethod()->OnFocus(); |
| 1549 |
| 1546 // TODO(beng): Investigate whether it's possible for us to move this to | 1550 // TODO(beng): Investigate whether it's possible for us to move this to |
| 1547 // Focus(). | 1551 // Focus(). |
| 1548 // Notify assistive technologies of the focus change. | 1552 // Notify assistive technologies of the focus change. |
| 1549 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_FOCUS, true); | 1553 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_FOCUS, true); |
| 1550 } | 1554 } |
| 1551 | 1555 |
| 1552 void View::OnBlur() { | 1556 void View::OnBlur() { |
| 1557 if (GetInputMethod()) |
| 1558 GetInputMethod()->OnBlur(); |
| 1553 } | 1559 } |
| 1554 | 1560 |
| 1555 void View::Focus() { | 1561 void View::Focus() { |
| 1556 SchedulePaint(); | 1562 SchedulePaint(); |
| 1557 OnFocus(); | 1563 OnFocus(); |
| 1558 } | 1564 } |
| 1559 | 1565 |
| 1560 void View::Blur() { | 1566 void View::Blur() { |
| 1561 SchedulePaint(); | 1567 SchedulePaint(); |
| 1562 OnBlur(); | 1568 OnBlur(); |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, | 2348 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, |
| 2343 source); | 2349 source); |
| 2344 | 2350 |
| 2345 return true; | 2351 return true; |
| 2346 #else | 2352 #else |
| 2347 return false; | 2353 return false; |
| 2348 #endif // !defined(OS_MACOSX) | 2354 #endif // !defined(OS_MACOSX) |
| 2349 } | 2355 } |
| 2350 | 2356 |
| 2351 } // namespace views | 2357 } // namespace views |
| OLD | NEW |