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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 // MousePressed. | 855 // MousePressed. |
856 return OnGestureEvent(event); | 856 return OnGestureEvent(event); |
857 } | 857 } |
858 | 858 |
859 // Accelerators ---------------------------------------------------------------- | 859 // Accelerators ---------------------------------------------------------------- |
860 | 860 |
861 void View::AddAccelerator(const ui::Accelerator& accelerator) { | 861 void View::AddAccelerator(const ui::Accelerator& accelerator) { |
862 if (!accelerators_.get()) | 862 if (!accelerators_.get()) |
863 accelerators_.reset(new std::vector<ui::Accelerator>()); | 863 accelerators_.reset(new std::vector<ui::Accelerator>()); |
864 | 864 |
865 DCHECK(std::find(accelerators_->begin(), accelerators_->end(), accelerator) == | 865 if (std::find(accelerators_->begin(), accelerators_->end(), accelerator) == |
866 accelerators_->end()) | 866 accelerators_->end()) { |
867 << "Registering the same accelerator multiple times"; | 867 accelerators_->push_back(accelerator); |
868 | 868 } |
869 accelerators_->push_back(accelerator); | |
870 RegisterPendingAccelerators(); | 869 RegisterPendingAccelerators(); |
871 } | 870 } |
872 | 871 |
873 void View::RemoveAccelerator(const ui::Accelerator& accelerator) { | 872 void View::RemoveAccelerator(const ui::Accelerator& accelerator) { |
874 if (!accelerators_.get()) { | 873 if (!accelerators_.get()) { |
875 NOTREACHED() << "Removing non-existing accelerator"; | 874 NOTREACHED() << "Removing non-existing accelerator"; |
876 return; | 875 return; |
877 } | 876 } |
878 | 877 |
879 std::vector<ui::Accelerator>::iterator i( | 878 std::vector<ui::Accelerator>::iterator i( |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 gfx::Point widget_location(event.location()); | 2065 gfx::Point widget_location(event.location()); |
2067 ConvertPointToWidget(this, &widget_location); | 2066 ConvertPointToWidget(this, &widget_location); |
2068 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2067 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
2069 return true; | 2068 return true; |
2070 #else | 2069 #else |
2071 return false; | 2070 return false; |
2072 #endif // !defined(OS_MACOSX) | 2071 #endif // !defined(OS_MACOSX) |
2073 } | 2072 } |
2074 | 2073 |
2075 } // namespace views | 2074 } // namespace views |
OLD | NEW |