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