| 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 #include "ui/views/view.h" | 5 #include "ui/views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 822 |
| 823 ui::GestureStatus View::OnGestureEvent(const GestureEvent& event) { | 823 ui::GestureStatus View::OnGestureEvent(const GestureEvent& event) { |
| 824 if (event.type() == ui::ET_GESTURE_LONG_PRESS) { | 824 if (event.type() == ui::ET_GESTURE_LONG_PRESS) { |
| 825 // TODO(XXX): Call CanStartDragForView first? | 825 // TODO(XXX): Call CanStartDragForView first? |
| 826 return DoDrag(event, event.location()) ? | 826 return DoDrag(event, event.location()) ? |
| 827 ui::GESTURE_STATUS_CONSUMED : ui::GESTURE_STATUS_UNKNOWN; | 827 ui::GESTURE_STATUS_CONSUMED : ui::GESTURE_STATUS_UNKNOWN; |
| 828 } | 828 } |
| 829 return ui::GESTURE_STATUS_UNKNOWN; | 829 return ui::GESTURE_STATUS_UNKNOWN; |
| 830 } | 830 } |
| 831 | 831 |
| 832 void View::SetMouseHandler(View *new_mouse_handler) { | 832 void View::SetMouseHandler(View* new_mouse_handler) { |
| 833 // It is valid for new_mouse_handler to be NULL | 833 // |new_mouse_handler| may be NULL. |
| 834 if (parent_) | 834 if (parent_) |
| 835 parent_->SetMouseHandler(new_mouse_handler); | 835 parent_->SetMouseHandler(new_mouse_handler); |
| 836 } | 836 } |
| 837 | 837 |
| 838 bool View::OnKeyPressed(const KeyEvent& event) { | 838 bool View::OnKeyPressed(const KeyEvent& event) { |
| 839 return false; | 839 return false; |
| 840 } | 840 } |
| 841 | 841 |
| 842 bool View::OnKeyReleased(const KeyEvent& event) { | 842 bool View::OnKeyReleased(const KeyEvent& event) { |
| 843 return false; | 843 return false; |
| 844 } | 844 } |
| 845 | 845 |
| 846 bool View::OnMouseWheel(const MouseWheelEvent& event) { | 846 bool View::OnMouseWheel(const MouseWheelEvent& event) { |
| 847 return false; | 847 return false; |
| 848 } | 848 } |
| 849 | 849 |
| 850 ui::TextInputClient* View::GetTextInputClient() { | 850 ui::TextInputClient* View::GetTextInputClient() { |
| 851 return NULL; | 851 return NULL; |
| 852 } | 852 } |
| 853 | 853 |
| 854 InputMethod* View::GetInputMethod() { | 854 InputMethod* View::GetInputMethod() { |
| 855 Widget* widget = GetWidget(); | 855 Widget* widget = GetWidget(); |
| 856 return widget ? widget->GetInputMethod() : NULL; | 856 return widget ? widget->GetInputMethod() : NULL; |
| 857 } | 857 } |
| 858 | 858 |
| 859 ui::GestureStatus View::ProcessGestureEvent(const GestureEvent& event) { | |
| 860 // TODO(Gajen): Implement a grab scheme similar to as as is found in | |
| 861 // MousePressed. | |
| 862 return OnGestureEvent(event); | |
| 863 } | |
| 864 | |
| 865 // Accelerators ---------------------------------------------------------------- | 859 // Accelerators ---------------------------------------------------------------- |
| 866 | 860 |
| 867 void View::AddAccelerator(const ui::Accelerator& accelerator) { | 861 void View::AddAccelerator(const ui::Accelerator& accelerator) { |
| 868 if (!accelerators_.get()) | 862 if (!accelerators_.get()) |
| 869 accelerators_.reset(new std::vector<ui::Accelerator>()); | 863 accelerators_.reset(new std::vector<ui::Accelerator>()); |
| 870 | 864 |
| 871 if (std::find(accelerators_->begin(), accelerators_->end(), accelerator) == | 865 if (std::find(accelerators_->begin(), accelerators_->end(), accelerator) == |
| 872 accelerators_->end()) { | 866 accelerators_->end()) { |
| 873 accelerators_->push_back(accelerator); | 867 accelerators_->push_back(accelerator); |
| 874 } | 868 } |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 gfx::Point widget_location(event.location()); | 2072 gfx::Point widget_location(event.location()); |
| 2079 ConvertPointToWidget(this, &widget_location); | 2073 ConvertPointToWidget(this, &widget_location); |
| 2080 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2074 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
| 2081 return true; | 2075 return true; |
| 2082 #else | 2076 #else |
| 2083 return false; | 2077 return false; |
| 2084 #endif // !defined(OS_MACOSX) | 2078 #endif // !defined(OS_MACOSX) |
| 2085 } | 2079 } |
| 2086 | 2080 |
| 2087 } // namespace views | 2081 } // namespace views |
| OLD | NEW |