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/test/ui_test_utils.h" | 5 #include "chrome/test/ui_test_utils.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 NSView* view = view_id_util::GetView(window, vid); | 22 NSView* view = view_id_util::GetView(window, vid); |
23 if (!view) | 23 if (!view) |
24 return false; | 24 return false; |
25 | 25 |
26 NSResponder* firstResponder = [window firstResponder]; | 26 NSResponder* firstResponder = [window firstResponder]; |
27 if (firstResponder == static_cast<NSResponder*>(view)) | 27 if (firstResponder == static_cast<NSResponder*>(view)) |
28 return true; | 28 return true; |
29 | 29 |
30 // Handle the special case of focusing a TextField. | 30 // Handle the special case of focusing a TextField. |
31 if ([firstResponder isKindOfClass:[NSTextView class]]) { | 31 if ([firstResponder isKindOfClass:[NSTextView class]]) { |
32 NSView* delegate = [(NSTextView*)firstResponder delegate]; | 32 NSView* delegate = static_cast<NSView*>([(NSTextView*)firstResponder |
| 33 delegate]); |
33 if (delegate == view) | 34 if (delegate == view) |
34 return true; | 35 return true; |
35 } | 36 } |
36 | 37 |
37 return false; | 38 return false; |
38 } | 39 } |
39 | 40 |
40 void ClickOnView(const Browser* browser, ViewID vid) { | 41 void ClickOnView(const Browser* browser, ViewID vid) { |
41 NSWindow* window = browser->window()->GetNativeHandle(); | 42 NSWindow* window = browser->window()->GetNativeHandle(); |
42 DCHECK(window); | 43 DCHECK(window); |
(...skipping 14 matching lines...) Expand all Loading... |
57 void ShowAndFocusNativeWindow(gfx::NativeWindow window) { | 58 void ShowAndFocusNativeWindow(gfx::NativeWindow window) { |
58 // Make sure an unbundled program can get the input focus. | 59 // Make sure an unbundled program can get the input focus. |
59 ProcessSerialNumber psn = { 0, kCurrentProcess }; | 60 ProcessSerialNumber psn = { 0, kCurrentProcess }; |
60 TransformProcessType(&psn,kProcessTransformToForegroundApplication); | 61 TransformProcessType(&psn,kProcessTransformToForegroundApplication); |
61 SetFrontProcess(&psn); | 62 SetFrontProcess(&psn); |
62 | 63 |
63 [window makeKeyAndOrderFront:nil]; | 64 [window makeKeyAndOrderFront:nil]; |
64 } | 65 } |
65 | 66 |
66 } // namespace ui_test_utils | 67 } // namespace ui_test_utils |
OLD | NEW |