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

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

Issue 793003004: MacViews: Implement event monitoring for a specific window (Reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Created 6 years 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/event_generator.h ('k') | ui/views/event_monitor.h » ('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 #include "ui/events/test/event_generator.h" 5 #include "ui/events/test/event_generator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 } // namespace 60 } // namespace
61 61
62 EventGeneratorDelegate* EventGenerator::default_delegate = NULL; 62 EventGeneratorDelegate* EventGenerator::default_delegate = NULL;
63 63
64 EventGenerator::EventGenerator(gfx::NativeWindow root_window) 64 EventGenerator::EventGenerator(gfx::NativeWindow root_window)
65 : current_target_(NULL), 65 : current_target_(NULL),
66 flags_(0), 66 flags_(0),
67 grab_(false), 67 grab_(false),
68 async_(false), 68 async_(false),
69 targeting_application_(false),
69 tick_clock_(new base::DefaultTickClock()) { 70 tick_clock_(new base::DefaultTickClock()) {
70 Init(root_window, NULL); 71 Init(root_window, NULL);
71 } 72 }
72 73
73 EventGenerator::EventGenerator(gfx::NativeWindow root_window, 74 EventGenerator::EventGenerator(gfx::NativeWindow root_window,
74 const gfx::Point& point) 75 const gfx::Point& point)
75 : current_location_(point), 76 : current_location_(point),
76 current_target_(NULL), 77 current_target_(NULL),
77 flags_(0), 78 flags_(0),
78 grab_(false), 79 grab_(false),
79 async_(false), 80 async_(false),
81 targeting_application_(false),
80 tick_clock_(new base::DefaultTickClock()) { 82 tick_clock_(new base::DefaultTickClock()) {
81 Init(root_window, NULL); 83 Init(root_window, NULL);
82 } 84 }
83 85
84 EventGenerator::EventGenerator(gfx::NativeWindow root_window, 86 EventGenerator::EventGenerator(gfx::NativeWindow root_window,
85 gfx::NativeWindow window) 87 gfx::NativeWindow window)
86 : current_target_(NULL), 88 : current_target_(NULL),
87 flags_(0), 89 flags_(0),
88 grab_(false), 90 grab_(false),
89 async_(false), 91 async_(false),
92 targeting_application_(false),
90 tick_clock_(new base::DefaultTickClock()) { 93 tick_clock_(new base::DefaultTickClock()) {
91 Init(root_window, window); 94 Init(root_window, window);
92 } 95 }
93 96
94 EventGenerator::EventGenerator(EventGeneratorDelegate* delegate) 97 EventGenerator::EventGenerator(EventGeneratorDelegate* delegate)
95 : delegate_(delegate), 98 : delegate_(delegate),
96 current_target_(NULL), 99 current_target_(NULL),
97 flags_(0), 100 flags_(0),
98 grab_(false), 101 grab_(false),
99 async_(false), 102 async_(false),
103 targeting_application_(false),
100 tick_clock_(new base::DefaultTickClock()) { 104 tick_clock_(new base::DefaultTickClock()) {
101 Init(NULL, NULL); 105 Init(NULL, NULL);
102 } 106 }
103 107
104 EventGenerator::~EventGenerator() { 108 EventGenerator::~EventGenerator() {
105 for (std::list<ui::Event*>::iterator i = pending_events_.begin(); 109 for (std::list<ui::Event*>::iterator i = pending_events_.begin();
106 i != pending_events_.end(); ++i) 110 i != pending_events_.end(); ++i)
107 delete *i; 111 delete *i;
108 pending_events_.clear(); 112 pending_events_.clear();
109 delegate()->SetContext(NULL, NULL, NULL); 113 delegate()->SetContext(NULL, NULL, NULL);
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return default_delegate; 638 return default_delegate;
635 } 639 }
636 640
637 EventGeneratorDelegate* EventGenerator::delegate() { 641 EventGeneratorDelegate* EventGenerator::delegate() {
638 return const_cast<EventGeneratorDelegate*>( 642 return const_cast<EventGeneratorDelegate*>(
639 const_cast<const EventGenerator*>(this)->delegate()); 643 const_cast<const EventGenerator*>(this)->delegate());
640 } 644 }
641 645
642 } // namespace test 646 } // namespace test
643 } // namespace ui 647 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/test/event_generator.h ('k') | ui/views/event_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698