Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: ui/events/event.cc

Issue 2259753003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/events/event.h" 5 #include "ui/events/event.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } // namespace 159 } // namespace
160 160
161 namespace ui { 161 namespace ui {
162 162
163 //////////////////////////////////////////////////////////////////////////////// 163 ////////////////////////////////////////////////////////////////////////////////
164 // Event 164 // Event
165 165
166 // static 166 // static
167 std::unique_ptr<Event> Event::Clone(const Event& event) { 167 std::unique_ptr<Event> Event::Clone(const Event& event) {
168 if (event.IsKeyEvent()) { 168 if (event.IsKeyEvent()) {
169 return base::WrapUnique(new KeyEvent(static_cast<const KeyEvent&>(event))); 169 return base::MakeUnique<KeyEvent>(static_cast<const KeyEvent&>(event));
170 } 170 }
171 171
172 if (event.IsMouseEvent()) { 172 if (event.IsMouseEvent()) {
173 if (event.IsMouseWheelEvent()) { 173 if (event.IsMouseWheelEvent()) {
174 return base::WrapUnique( 174 return base::MakeUnique<MouseWheelEvent>(
175 new MouseWheelEvent(static_cast<const MouseWheelEvent&>(event))); 175 static_cast<const MouseWheelEvent&>(event));
176 } 176 }
177 177
178 return base::WrapUnique( 178 return base::MakeUnique<MouseEvent>(static_cast<const MouseEvent&>(event));
179 new MouseEvent(static_cast<const MouseEvent&>(event)));
180 } 179 }
181 180
182 if (event.IsTouchEvent()) { 181 if (event.IsTouchEvent()) {
183 return base::WrapUnique( 182 return base::MakeUnique<TouchEvent>(static_cast<const TouchEvent&>(event));
184 new TouchEvent(static_cast<const TouchEvent&>(event)));
185 } 183 }
186 184
187 if (event.IsGestureEvent()) { 185 if (event.IsGestureEvent()) {
188 return base::WrapUnique( 186 return base::MakeUnique<GestureEvent>(
189 new GestureEvent(static_cast<const GestureEvent&>(event))); 187 static_cast<const GestureEvent&>(event));
190 } 188 }
191 189
192 if (event.IsPointerEvent()) { 190 if (event.IsPointerEvent()) {
193 return base::WrapUnique( 191 return base::MakeUnique<PointerEvent>(
194 new PointerEvent(static_cast<const PointerEvent&>(event))); 192 static_cast<const PointerEvent&>(event));
195 } 193 }
196 194
197 if (event.IsScrollEvent()) { 195 if (event.IsScrollEvent()) {
198 return base::WrapUnique( 196 return base::MakeUnique<ScrollEvent>(
199 new ScrollEvent(static_cast<const ScrollEvent&>(event))); 197 static_cast<const ScrollEvent&>(event));
200 } 198 }
201 199
202 return base::WrapUnique(new Event(event)); 200 return base::WrapUnique(new Event(event));
203 } 201 }
204 202
205 Event::~Event() { 203 Event::~Event() {
206 if (delete_native_event_) 204 if (delete_native_event_)
207 ReleaseCopiedNativeEvent(native_event_); 205 ReleaseCopiedNativeEvent(native_event_);
208 } 206 }
209 207
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 gfx::PointF(x, y), 1282 gfx::PointF(x, y),
1285 time_stamp, 1283 time_stamp,
1286 flags | EF_FROM_TOUCH), 1284 flags | EF_FROM_TOUCH),
1287 details_(details), 1285 details_(details),
1288 unique_touch_event_id_(unique_touch_event_id) {} 1286 unique_touch_event_id_(unique_touch_event_id) {}
1289 1287
1290 GestureEvent::~GestureEvent() { 1288 GestureEvent::~GestureEvent() {
1291 } 1289 }
1292 1290
1293 } // namespace ui 1291 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/update_display_configuration_task_unittest.cc ('k') | ui/events/event_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698