OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/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/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "chrome/browser/automation/ui_controls_internal.h" | 12 #include "chrome/browser/automation/ui_controls_internal.h" |
13 #include "chrome/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
14 #include "ui/base/keycodes/keyboard_code_conversion_mac.h" | 14 #include "ui/base/keycodes/keyboard_code_conversion_mac.h" |
15 | 15 |
16 // Implementation details: We use [NSApplication sendEvent:] instead | 16 // Implementation details: We use [NSApplication sendEvent:] instead |
17 // of [NSApplication postEvent:atStart:] so that the event gets sent | 17 // of [NSApplication postEvent:atStart:] so that the event gets sent |
18 // immediately. This lets us run the post-event task right | 18 // immediately. This lets us run the post-event task right |
19 // immediately as well. Unfortunately I cannot subclass NSEvent (it's | 19 // immediately as well. Unfortunately I cannot subclass NSEvent (it's |
20 // probably a class cluster) to allow other easy answers. For | 20 // probably a class cluster) to allow other easy answers. For |
21 // example, if I could subclass NSEvent, I could run the Task in it's | 21 // example, if I could subclass NSEvent, I could run the Task in it's |
22 // dealloc routine (which necessarily happens after the event is | 22 // dealloc routine (which necessarily happens after the event is |
23 // dispatched). Unlike Linux, Mac does not have message loop | 23 // dispatched). Unlike Linux, Mac does not have message loop |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); | 373 NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); |
374 center = [view convertPoint:center toView:nil]; | 374 center = [view convertPoint:center toView:nil]; |
375 center = [window convertBaseToScreen:center]; | 375 center = [window convertBaseToScreen:center]; |
376 center = NSMakePoint(center.x, [screen frame].size.height - center.y); | 376 center = NSMakePoint(center.x, [screen frame].size.height - center.y); |
377 | 377 |
378 SendMouseMoveNotifyWhenDone(center.x, center.y, | 378 SendMouseMoveNotifyWhenDone(center.x, center.y, |
379 new ClickTask(button, state, task)); | 379 new ClickTask(button, state, task)); |
380 } | 380 } |
381 | 381 |
382 } // ui_controls | 382 } // ui_controls |
OLD | NEW |