| 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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 ui::LocatedEvent* event) { | 1102 ui::LocatedEvent* event) { |
| 1103 event->ConvertLocationToTarget(this, static_cast<View*>(target)); | 1103 event->ConvertLocationToTarget(this, static_cast<View*>(target)); |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 // Accelerators ---------------------------------------------------------------- | 1106 // Accelerators ---------------------------------------------------------------- |
| 1107 | 1107 |
| 1108 void View::AddAccelerator(const ui::Accelerator& accelerator) { | 1108 void View::AddAccelerator(const ui::Accelerator& accelerator) { |
| 1109 if (!accelerators_.get()) | 1109 if (!accelerators_.get()) |
| 1110 accelerators_.reset(new std::vector<ui::Accelerator>()); | 1110 accelerators_.reset(new std::vector<ui::Accelerator>()); |
| 1111 | 1111 |
| 1112 if (!ContainsValue(*accelerators_.get(), accelerator)) | 1112 if (!base::ContainsValue(*accelerators_.get(), accelerator)) |
| 1113 accelerators_->push_back(accelerator); | 1113 accelerators_->push_back(accelerator); |
| 1114 | 1114 |
| 1115 RegisterPendingAccelerators(); | 1115 RegisterPendingAccelerators(); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 void View::RemoveAccelerator(const ui::Accelerator& accelerator) { | 1118 void View::RemoveAccelerator(const ui::Accelerator& accelerator) { |
| 1119 if (!accelerators_.get()) { | 1119 if (!accelerators_.get()) { |
| 1120 NOTREACHED() << "Removing non-existing accelerator"; | 1120 NOTREACHED() << "Removing non-existing accelerator"; |
| 1121 return; | 1121 return; |
| 1122 } | 1122 } |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 // Message the RootView to do the drag and drop. That way if we're removed | 2420 // Message the RootView to do the drag and drop. That way if we're removed |
| 2421 // the RootView can detect it and avoid calling us back. | 2421 // the RootView can detect it and avoid calling us back. |
| 2422 gfx::Point widget_location(event.location()); | 2422 gfx::Point widget_location(event.location()); |
| 2423 ConvertPointToWidget(this, &widget_location); | 2423 ConvertPointToWidget(this, &widget_location); |
| 2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2425 // WARNING: we may have been deleted. | 2425 // WARNING: we may have been deleted. |
| 2426 return true; | 2426 return true; |
| 2427 } | 2427 } |
| 2428 | 2428 |
| 2429 } // namespace views | 2429 } // namespace views |
| OLD | NEW |