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 21 matching lines...) Expand all Loading... |
32 #include "ui/gfx/geometry/point3_f.h" | 32 #include "ui/gfx/geometry/point3_f.h" |
33 #include "ui/gfx/geometry/point_conversions.h" | 33 #include "ui/gfx/geometry/point_conversions.h" |
34 #include "ui/gfx/interpolated_transform.h" | 34 #include "ui/gfx/interpolated_transform.h" |
35 #include "ui/gfx/path.h" | 35 #include "ui/gfx/path.h" |
36 #include "ui/gfx/scoped_canvas.h" | 36 #include "ui/gfx/scoped_canvas.h" |
37 #include "ui/gfx/screen.h" | 37 #include "ui/gfx/screen.h" |
38 #include "ui/gfx/skia_util.h" | 38 #include "ui/gfx/skia_util.h" |
39 #include "ui/gfx/transform.h" | 39 #include "ui/gfx/transform.h" |
40 #include "ui/native_theme/native_theme.h" | 40 #include "ui/native_theme/native_theme.h" |
41 #include "ui/views/accessibility/native_view_accessibility.h" | 41 #include "ui/views/accessibility/native_view_accessibility.h" |
| 42 #include "ui/views/animation/ink_drop_delegate.h" |
42 #include "ui/views/background.h" | 43 #include "ui/views/background.h" |
43 #include "ui/views/border.h" | 44 #include "ui/views/border.h" |
44 #include "ui/views/context_menu_controller.h" | 45 #include "ui/views/context_menu_controller.h" |
45 #include "ui/views/drag_controller.h" | 46 #include "ui/views/drag_controller.h" |
46 #include "ui/views/focus/view_storage.h" | 47 #include "ui/views/focus/view_storage.h" |
47 #include "ui/views/layout/layout_manager.h" | 48 #include "ui/views/layout/layout_manager.h" |
48 #include "ui/views/views_delegate.h" | 49 #include "ui/views/views_delegate.h" |
49 #include "ui/views/widget/native_widget_private.h" | 50 #include "ui/views/widget/native_widget_private.h" |
50 #include "ui/views/widget/root_view.h" | 51 #include "ui/views/widget/root_view.h" |
51 #include "ui/views/widget/tooltip_manager.h" | 52 #include "ui/views/widget/tooltip_manager.h" |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 } | 1009 } |
1009 | 1010 |
1010 void View::OnScrollEvent(ui::ScrollEvent* event) { | 1011 void View::OnScrollEvent(ui::ScrollEvent* event) { |
1011 } | 1012 } |
1012 | 1013 |
1013 void View::OnTouchEvent(ui::TouchEvent* event) { | 1014 void View::OnTouchEvent(ui::TouchEvent* event) { |
1014 NOTREACHED() << "Views should not receive touch events."; | 1015 NOTREACHED() << "Views should not receive touch events."; |
1015 } | 1016 } |
1016 | 1017 |
1017 void View::OnGestureEvent(ui::GestureEvent* event) { | 1018 void View::OnGestureEvent(ui::GestureEvent* event) { |
| 1019 InkDropDelegate* ink_drop_delegate = GetInkDropDelegate(); |
| 1020 if (ink_drop_delegate) |
| 1021 ink_drop_delegate->OnGestureEvent(event); |
1018 } | 1022 } |
1019 | 1023 |
1020 const ui::InputMethod* View::GetInputMethod() const { | 1024 const ui::InputMethod* View::GetInputMethod() const { |
1021 Widget* widget = const_cast<Widget*>(GetWidget()); | 1025 Widget* widget = const_cast<Widget*>(GetWidget()); |
1022 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) | 1026 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) |
1023 : nullptr; | 1027 : nullptr; |
1024 } | 1028 } |
1025 | 1029 |
1026 scoped_ptr<ViewTargeter> | 1030 scoped_ptr<ViewTargeter> |
1027 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { | 1031 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 // Iterate backwards through the children so that a child with a layer | 1516 // Iterate backwards through the children so that a child with a layer |
1513 // which is further to the back is stacked above one which is further to | 1517 // which is further to the back is stacked above one which is further to |
1514 // the front. | 1518 // the front. |
1515 for (Views::reverse_iterator it(children_.rbegin()); | 1519 for (Views::reverse_iterator it(children_.rbegin()); |
1516 it != children_.rend(); ++it) { | 1520 it != children_.rend(); ++it) { |
1517 (*it)->ReorderChildLayers(parent_layer); | 1521 (*it)->ReorderChildLayers(parent_layer); |
1518 } | 1522 } |
1519 } | 1523 } |
1520 } | 1524 } |
1521 | 1525 |
| 1526 // Animations ---------------------------------------------------------------- |
| 1527 |
| 1528 InkDropDelegate* View::GetInkDropDelegate() const { |
| 1529 return nullptr; |
| 1530 } |
| 1531 |
1522 // Input ----------------------------------------------------------------------- | 1532 // Input ----------------------------------------------------------------------- |
1523 | 1533 |
1524 View::DragInfo* View::GetDragInfo() { | 1534 View::DragInfo* View::GetDragInfo() { |
1525 return parent_ ? parent_->GetDragInfo() : NULL; | 1535 return parent_ ? parent_->GetDragInfo() : NULL; |
1526 } | 1536 } |
1527 | 1537 |
1528 // Focus ----------------------------------------------------------------------- | 1538 // Focus ----------------------------------------------------------------------- |
1529 | 1539 |
1530 void View::OnFocus() { | 1540 void View::OnFocus() { |
1531 // TODO(beng): Investigate whether it's possible for us to move this to | 1541 // TODO(beng): Investigate whether it's possible for us to move this to |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 // Message the RootView to do the drag and drop. That way if we're removed | 2364 // Message the RootView to do the drag and drop. That way if we're removed |
2355 // the RootView can detect it and avoid calling us back. | 2365 // the RootView can detect it and avoid calling us back. |
2356 gfx::Point widget_location(event.location()); | 2366 gfx::Point widget_location(event.location()); |
2357 ConvertPointToWidget(this, &widget_location); | 2367 ConvertPointToWidget(this, &widget_location); |
2358 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2368 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2359 // WARNING: we may have been deleted. | 2369 // WARNING: we may have been deleted. |
2360 return true; | 2370 return true; |
2361 } | 2371 } |
2362 | 2372 |
2363 } // namespace views | 2373 } // namespace views |
OLD | NEW |