Chromium Code Reviews| 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/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/stl_util.h" | |
| 15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 18 #include "third_party/skia/include/core/SkRect.h" | 19 #include "third_party/skia/include/core/SkRect.h" |
| 19 #include "ui/accessibility/ax_enums.h" | 20 #include "ui/accessibility/ax_enums.h" |
| 20 #include "ui/base/cursor/cursor.h" | 21 #include "ui/base/cursor/cursor.h" |
| 21 #include "ui/base/dragdrop/drag_drop_types.h" | 22 #include "ui/base/dragdrop/drag_drop_types.h" |
| 22 #include "ui/base/ime/input_method.h" | 23 #include "ui/base/ime/input_method.h" |
| 23 #include "ui/compositor/clip_recorder.h" | 24 #include "ui/compositor/clip_recorder.h" |
| 24 #include "ui/compositor/compositor.h" | 25 #include "ui/compositor/compositor.h" |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 ui::LocatedEvent* event) { | 1084 ui::LocatedEvent* event) { |
| 1084 event->ConvertLocationToTarget(this, static_cast<View*>(target)); | 1085 event->ConvertLocationToTarget(this, static_cast<View*>(target)); |
| 1085 } | 1086 } |
| 1086 | 1087 |
| 1087 // Accelerators ---------------------------------------------------------------- | 1088 // Accelerators ---------------------------------------------------------------- |
| 1088 | 1089 |
| 1089 void View::AddAccelerator(const ui::Accelerator& accelerator) { | 1090 void View::AddAccelerator(const ui::Accelerator& accelerator) { |
| 1090 if (!accelerators_.get()) | 1091 if (!accelerators_.get()) |
| 1091 accelerators_.reset(new std::vector<ui::Accelerator>()); | 1092 accelerators_.reset(new std::vector<ui::Accelerator>()); |
| 1092 | 1093 |
| 1093 if (std::find(accelerators_->begin(), accelerators_->end(), accelerator) == | 1094 if (!ContainsValue(accelerators_.get(), accelerator)) { |
|
sky
2015/12/01 22:08:31
nit: nuke {}
tfarina
2015/12/02 20:31:41
Done.
| |
| 1094 accelerators_->end()) { | |
| 1095 accelerators_->push_back(accelerator); | 1095 accelerators_->push_back(accelerator); |
| 1096 } | 1096 } |
| 1097 RegisterPendingAccelerators(); | 1097 RegisterPendingAccelerators(); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 void View::RemoveAccelerator(const ui::Accelerator& accelerator) { | 1100 void View::RemoveAccelerator(const ui::Accelerator& accelerator) { |
| 1101 if (!accelerators_.get()) { | 1101 if (!accelerators_.get()) { |
| 1102 NOTREACHED() << "Removing non-existing accelerator"; | 1102 NOTREACHED() << "Removing non-existing accelerator"; |
| 1103 return; | 1103 return; |
| 1104 } | 1104 } |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2378 // Message the RootView to do the drag and drop. That way if we're removed | 2378 // Message the RootView to do the drag and drop. That way if we're removed |
| 2379 // the RootView can detect it and avoid calling us back. | 2379 // the RootView can detect it and avoid calling us back. |
| 2380 gfx::Point widget_location(event.location()); | 2380 gfx::Point widget_location(event.location()); |
| 2381 ConvertPointToWidget(this, &widget_location); | 2381 ConvertPointToWidget(this, &widget_location); |
| 2382 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2382 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2383 // WARNING: we may have been deleted. | 2383 // WARNING: we may have been deleted. |
| 2384 return true; | 2384 return true; |
| 2385 } | 2385 } |
| 2386 | 2386 |
| 2387 } // namespace views | 2387 } // namespace views |
| OLD | NEW |