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> |
11 | 11 |
| 12 #include "base/command_line.h" |
12 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
18 #include "third_party/skia/include/core/SkRect.h" | 19 #include "third_party/skia/include/core/SkRect.h" |
19 #include "ui/base/accessibility/accessibility_types.h" | 20 #include "ui/base/accessibility/accessibility_types.h" |
20 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" |
21 #include "ui/base/ui_base_switches_util.h" | 22 #include "ui/base/ui_base_switches.h" |
22 #include "ui/compositor/compositor.h" | 23 #include "ui/compositor/compositor.h" |
23 #include "ui/compositor/layer.h" | 24 #include "ui/compositor/layer.h" |
24 #include "ui/compositor/layer_animator.h" | 25 #include "ui/compositor/layer_animator.h" |
25 #include "ui/gfx/canvas.h" | 26 #include "ui/gfx/canvas.h" |
26 #include "ui/gfx/interpolated_transform.h" | 27 #include "ui/gfx/interpolated_transform.h" |
27 #include "ui/gfx/path.h" | 28 #include "ui/gfx/path.h" |
28 #include "ui/gfx/point3_f.h" | 29 #include "ui/gfx/point3_f.h" |
29 #include "ui/gfx/point_conversions.h" | 30 #include "ui/gfx/point_conversions.h" |
30 #include "ui/gfx/rect_conversions.h" | 31 #include "ui/gfx/rect_conversions.h" |
31 #include "ui/gfx/skia_util.h" | 32 #include "ui/gfx/skia_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 101 |
101 namespace internal { | 102 namespace internal { |
102 | 103 |
103 // This event handler receives events in the post-target phase and takes care of | 104 // This event handler receives events in the post-target phase and takes care of |
104 // the following: | 105 // the following: |
105 // - Generates context menu, or initiates drag-and-drop, from gesture events. | 106 // - Generates context menu, or initiates drag-and-drop, from gesture events. |
106 class PostEventDispatchHandler : public ui::EventHandler { | 107 class PostEventDispatchHandler : public ui::EventHandler { |
107 public: | 108 public: |
108 explicit PostEventDispatchHandler(View* owner) | 109 explicit PostEventDispatchHandler(View* owner) |
109 : owner_(owner), | 110 : owner_(owner), |
110 touch_dnd_enabled_(switches::IsTouchDragDropEnabled()) { | 111 touch_dnd_enabled_(CommandLine::ForCurrentProcess()->HasSwitch( |
| 112 switches::kEnableTouchDragDrop)) { |
111 } | 113 } |
112 virtual ~PostEventDispatchHandler() {} | 114 virtual ~PostEventDispatchHandler() {} |
113 | 115 |
114 private: | 116 private: |
115 // Overridden from ui::EventHandler: | 117 // Overridden from ui::EventHandler: |
116 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 118 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
117 DCHECK_EQ(ui::EP_POSTTARGET, event->phase()); | 119 DCHECK_EQ(ui::EP_POSTTARGET, event->phase()); |
118 if (event->handled()) | 120 if (event->handled()) |
119 return; | 121 return; |
120 | 122 |
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 ConvertPointToWidget(this, &widget_location); | 2275 ConvertPointToWidget(this, &widget_location); |
2274 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, | 2276 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, |
2275 source); | 2277 source); |
2276 return true; | 2278 return true; |
2277 #else | 2279 #else |
2278 return false; | 2280 return false; |
2279 #endif // !defined(OS_MACOSX) | 2281 #endif // !defined(OS_MACOSX) |
2280 } | 2282 } |
2281 | 2283 |
2282 } // namespace views | 2284 } // namespace views |
OLD | NEW |