| 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 } | 876 } |
| 877 | 877 |
| 878 ui::EventResult View::OnScrollEvent(ui::ScrollEvent* event) { | 878 ui::EventResult View::OnScrollEvent(ui::ScrollEvent* event) { |
| 879 return ui::ER_UNHANDLED; | 879 return ui::ER_UNHANDLED; |
| 880 } | 880 } |
| 881 | 881 |
| 882 ui::EventResult View::OnTouchEvent(ui::TouchEvent* event) { | 882 ui::EventResult View::OnTouchEvent(ui::TouchEvent* event) { |
| 883 return ui::ER_UNHANDLED; | 883 return ui::ER_UNHANDLED; |
| 884 } | 884 } |
| 885 | 885 |
| 886 ui::EventResult View::OnGestureEvent(ui::GestureEvent* event) { | 886 void View::OnGestureEvent(ui::GestureEvent* event) { |
| 887 return ui::ER_UNHANDLED; | |
| 888 } | 887 } |
| 889 | 888 |
| 890 ui::TextInputClient* View::GetTextInputClient() { | 889 ui::TextInputClient* View::GetTextInputClient() { |
| 891 return NULL; | 890 return NULL; |
| 892 } | 891 } |
| 893 | 892 |
| 894 InputMethod* View::GetInputMethod() { | 893 InputMethod* View::GetInputMethod() { |
| 895 Widget* widget = GetWidget(); | 894 Widget* widget = GetWidget(); |
| 896 return widget ? widget->GetInputMethod() : NULL; | 895 return widget ? widget->GetInputMethod() : NULL; |
| 897 } | 896 } |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 } else { | 1991 } else { |
| 1993 OnMouseReleased(event); | 1992 OnMouseReleased(event); |
| 1994 } | 1993 } |
| 1995 // WARNING: we may have been deleted. | 1994 // WARNING: we may have been deleted. |
| 1996 } | 1995 } |
| 1997 | 1996 |
| 1998 ui::EventResult View::ProcessTouchEvent(ui::TouchEvent* event) { | 1997 ui::EventResult View::ProcessTouchEvent(ui::TouchEvent* event) { |
| 1999 return OnTouchEvent(event); | 1998 return OnTouchEvent(event); |
| 2000 } | 1999 } |
| 2001 | 2000 |
| 2002 ui::EventResult View::ProcessGestureEvent(ui::GestureEvent* event) { | 2001 void View::ProcessGestureEvent(ui::GestureEvent* event) { |
| 2003 ui::EventResult status = OnGestureEvent(event); | 2002 OnGestureEvent(event); |
| 2004 if (status != ui::ER_UNHANDLED) | 2003 if (event->handled()) |
| 2005 return status; | 2004 return; |
| 2006 | 2005 |
| 2007 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2006 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2008 switches::kEnableTouchDragDrop)) { | 2007 switches::kEnableTouchDragDrop)) { |
| 2009 if (event->type() == ui::ET_GESTURE_LONG_PRESS && | 2008 if (event->type() == ui::ET_GESTURE_LONG_PRESS && |
| 2010 (!drag_controller_ || drag_controller_->CanStartDragForView( | 2009 (!drag_controller_ || drag_controller_->CanStartDragForView( |
| 2011 this, event->location(), event->location()))) { | 2010 this, event->location(), event->location()))) { |
| 2012 if (DoDrag(*event, event->location(), | 2011 if (DoDrag(*event, event->location(), |
| 2013 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)) | 2012 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)) { |
| 2014 return ui::ER_CONSUMED; | 2013 event->StopPropagation(); |
| 2014 return; |
| 2015 } |
| 2015 } | 2016 } |
| 2016 } | 2017 } |
| 2017 | 2018 |
| 2018 if (context_menu_controller_ && | 2019 if (context_menu_controller_ && |
| 2019 (event->type() == ui::ET_GESTURE_LONG_PRESS || | 2020 (event->type() == ui::ET_GESTURE_LONG_PRESS || |
| 2020 event->type() == ui::ET_GESTURE_LONG_TAP || | 2021 event->type() == ui::ET_GESTURE_LONG_TAP || |
| 2021 event->type() == ui::ET_GESTURE_TWO_FINGER_TAP)) { | 2022 event->type() == ui::ET_GESTURE_TWO_FINGER_TAP)) { |
| 2022 gfx::Point location(event->location()); | 2023 gfx::Point location(event->location()); |
| 2023 ConvertPointToScreen(this, &location); | 2024 ConvertPointToScreen(this, &location); |
| 2024 ShowContextMenu(location, true); | 2025 ShowContextMenu(location, true); |
| 2025 return ui::ER_CONSUMED; | 2026 event->StopPropagation(); |
| 2026 } | 2027 } |
| 2027 return status; | |
| 2028 } | 2028 } |
| 2029 | 2029 |
| 2030 // Accelerators ---------------------------------------------------------------- | 2030 // Accelerators ---------------------------------------------------------------- |
| 2031 | 2031 |
| 2032 void View::RegisterPendingAccelerators() { | 2032 void View::RegisterPendingAccelerators() { |
| 2033 if (!accelerators_.get() || | 2033 if (!accelerators_.get() || |
| 2034 registered_accelerator_count_ == accelerators_->size()) { | 2034 registered_accelerator_count_ == accelerators_->size()) { |
| 2035 // No accelerators are waiting for registration. | 2035 // No accelerators are waiting for registration. |
| 2036 return; | 2036 return; |
| 2037 } | 2037 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 ConvertPointToWidget(this, &widget_location); | 2166 ConvertPointToWidget(this, &widget_location); |
| 2167 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, | 2167 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, |
| 2168 source); | 2168 source); |
| 2169 return true; | 2169 return true; |
| 2170 #else | 2170 #else |
| 2171 return false; | 2171 return false; |
| 2172 #endif // !defined(OS_MACOSX) | 2172 #endif // !defined(OS_MACOSX) |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 } // namespace views | 2175 } // namespace views |
| OLD | NEW |