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

Side by Side Diff: ui/events/test/event_generator.h

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
« no previous file with comments | « ui/events/test/device_data_manager_test_api.h ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_EVENTS_TEST_EVENT_GENERATOR_H_ 5 #ifndef UI_EVENTS_TEST_EVENT_GENERATOR_H_
6 #define UI_EVENTS_TEST_EVENT_GENERATOR_H_ 6 #define UI_EVENTS_TEST_EVENT_GENERATOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "ui/events/event_constants.h" 15 #include "ui/events/event_constants.h"
16 #include "ui/events/keycodes/keyboard_codes.h" 16 #include "ui/events/keycodes/keyboard_codes.h"
17 #include "ui/gfx/geometry/point.h" 17 #include "ui/gfx/geometry/point.h"
18 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
19 19
20 namespace base { 20 namespace base {
21 class TickClock; 21 class TickClock;
22 } 22 }
23 23
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void ReleaseKey(KeyboardCode key_code, int flags); 362 void ReleaseKey(KeyboardCode key_code, int flags);
363 363
364 // Dispatch the event to the WindowEventDispatcher. 364 // Dispatch the event to the WindowEventDispatcher.
365 void Dispatch(Event* event); 365 void Dispatch(Event* event);
366 366
367 void set_current_target(EventTarget* target) { 367 void set_current_target(EventTarget* target) {
368 current_target_ = target; 368 current_target_ = target;
369 } 369 }
370 370
371 // Specify an alternative tick clock to be used for simulating time in tests. 371 // Specify an alternative tick clock to be used for simulating time in tests.
372 void SetTickClock(scoped_ptr<base::TickClock> tick_clock); 372 void SetTickClock(std::unique_ptr<base::TickClock> tick_clock);
373 373
374 // Get the current time from the tick clock. 374 // Get the current time from the tick clock.
375 base::TimeDelta Now(); 375 base::TimeDelta Now();
376 376
377 // Default delegate set by a platform-specific GeneratorDelegate singleton. 377 // Default delegate set by a platform-specific GeneratorDelegate singleton.
378 static EventGeneratorDelegate* default_delegate; 378 static EventGeneratorDelegate* default_delegate;
379 379
380 private: 380 private:
381 // Set up the test context using the delegate. 381 // Set up the test context using the delegate.
382 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context); 382 void Init(gfx::NativeWindow root_window, gfx::NativeWindow window_context);
383 383
384 // Dispatch a key event to the WindowEventDispatcher. 384 // Dispatch a key event to the WindowEventDispatcher.
385 void DispatchKeyEvent(bool is_press, KeyboardCode key_code, int flags); 385 void DispatchKeyEvent(bool is_press, KeyboardCode key_code, int flags);
386 386
387 void UpdateCurrentDispatcher(const gfx::Point& point); 387 void UpdateCurrentDispatcher(const gfx::Point& point);
388 void PressButton(int flag); 388 void PressButton(int flag);
389 void ReleaseButton(int flag); 389 void ReleaseButton(int flag);
390 390
391 gfx::Point GetLocationInCurrentRoot() const; 391 gfx::Point GetLocationInCurrentRoot() const;
392 gfx::Point CenterOfWindow(const EventTarget* window) const; 392 gfx::Point CenterOfWindow(const EventTarget* window) const;
393 393
394 void DispatchNextPendingEvent(); 394 void DispatchNextPendingEvent();
395 void DoDispatchEvent(Event* event, bool async); 395 void DoDispatchEvent(Event* event, bool async);
396 396
397 const EventGeneratorDelegate* delegate() const; 397 const EventGeneratorDelegate* delegate() const;
398 EventGeneratorDelegate* delegate(); 398 EventGeneratorDelegate* delegate();
399 399
400 scoped_ptr<EventGeneratorDelegate> delegate_; 400 std::unique_ptr<EventGeneratorDelegate> delegate_;
401 gfx::Point current_location_; 401 gfx::Point current_location_;
402 EventTarget* current_target_; 402 EventTarget* current_target_;
403 int flags_; 403 int flags_;
404 bool grab_; 404 bool grab_;
405 std::list<scoped_ptr<Event>> pending_events_; 405 std::list<std::unique_ptr<Event>> pending_events_;
406 // Set to true to cause events to be posted asynchronously. 406 // Set to true to cause events to be posted asynchronously.
407 bool async_; 407 bool async_;
408 bool targeting_application_; 408 bool targeting_application_;
409 scoped_ptr<base::TickClock> tick_clock_; 409 std::unique_ptr<base::TickClock> tick_clock_;
410 410
411 DISALLOW_COPY_AND_ASSIGN(EventGenerator); 411 DISALLOW_COPY_AND_ASSIGN(EventGenerator);
412 }; 412 };
413 413
414 } // namespace test 414 } // namespace test
415 } // namespace ui 415 } // namespace ui
416 416
417 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ 417 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_
OLDNEW
« no previous file with comments | « ui/events/test/device_data_manager_test_api.h ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698