OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/base/test/ui_controls.h" | 5 #include "ui/base/test/ui_controls.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <mach/mach_time.h> | 8 #include <mach/mach_time.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "ui/base/keycodes/keyboard_code_conversion_mac.h" | 14 #include "ui/base/keycodes/keyboard_code_conversion_mac.h" |
15 | 15 |
16 | 16 |
17 // Implementation details: We use [NSApplication sendEvent:] instead | 17 // Implementation details: We use [NSApplication sendEvent:] instead |
18 // of [NSApplication postEvent:atStart:] so that the event gets sent | 18 // of [NSApplication postEvent:atStart:] so that the event gets sent |
19 // immediately. This lets us run the post-event task right | 19 // immediately. This lets us run the post-event task right |
20 // immediately as well. Unfortunately I cannot subclass NSEvent (it's | 20 // immediately as well. Unfortunately I cannot subclass NSEvent (it's |
21 // probably a class cluster) to allow other easy answers. For | 21 // probably a class cluster) to allow other easy answers. For |
22 // example, if I could subclass NSEvent, I could run the Task in it's | 22 // example, if I could subclass NSEvent, I could run the Task in it's |
23 // dealloc routine (which necessarily happens after the event is | 23 // dealloc routine (which necessarily happens after the event is |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 364 |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 bool SendMouseClick(MouseButton type) { | 368 bool SendMouseClick(MouseButton type) { |
369 CHECK(g_ui_controls_enabled); | 369 CHECK(g_ui_controls_enabled); |
370 return SendMouseEventsNotifyWhenDone(type, UP|DOWN, base::Closure()); | 370 return SendMouseEventsNotifyWhenDone(type, UP|DOWN, base::Closure()); |
371 } | 371 } |
372 | 372 |
373 } // namespace ui_controls | 373 } // namespace ui_controls |
OLD | NEW |