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

Side by Side Diff: chrome/browser/automation/ui_controls_linux.cc

Issue 164446: linux: More automation porting. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: automation ipc messages hack fix Created 11 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <gtk/gtk.h>
8 #include <gdk/gdkkeysyms.h>
9
7 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/test/automation/automation_constants.h"
12
13 namespace {
14
15 int GdkKeycodeForWindowsKeycode(wchar_t windows_keyval) {
16 switch (windows_keyval) {
17 case VK_SPACE:
18 return GDK_space;
19 default:
20 NOTREACHED() << "Unsupported keyval: " << windows_keyval;
21 return 0;
22 }
23 }
24
25 } // namespace
8 26
9 namespace ui_controls { 27 namespace ui_controls {
10 28
11 bool SendKeyPress(wchar_t key, bool control, bool shift, bool alt) { 29 bool SendKeyPress(gfx::NativeWindow window,
12 NOTIMPLEMENTED(); 30 wchar_t key, bool control, bool shift, bool alt) {
13 return false; 31 GdkEvent* event = gdk_event_new(GDK_KEY_PRESS);
32
33 event->key.type = GDK_KEY_PRESS;
34 event->key.window = GTK_WIDGET(window)->window;
35 g_object_ref(event->key.window);
36 event->key.send_event = false;
37 // TODO(estade): Put the real time?
38 event->key.time = GDK_CURRENT_TIME;
39 // TODO(estade): handle other state flags besides control, shift, alt?
40 // For example caps lock.
41 event->key.state = (control ? GDK_CONTROL_MASK : 0) |
42 (shift ? GDK_SHIFT_MASK : 0) |
43 (alt ? GDK_MOD1_MASK : 0);
44 event->key.keyval = GdkKeycodeForWindowsKeycode(key);
45 // TODO(estade): fill in the string?
46
47 GdkKeymapKey* keys;
48 gint n_keys;
49 if (!gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
50 event->key.keyval, &keys, &n_keys)) {
51 return false;
52 }
53 event->key.hardware_keycode = keys[0].keycode;
54 event->key.group = keys[0].group;
55 g_free(keys);
56
57 gdk_event_put(event);
58 // gdk_event_put appends a copy of the event.
59 gdk_event_free(event);
60 return true;
14 } 61 }
15 62
16 bool SendKeyPressNotifyWhenDone(wchar_t key, bool control, bool shift, 63 bool SendKeyPressNotifyWhenDone(wchar_t key, bool control, bool shift,
17 bool alt, Task* task) { 64 bool alt, Task* task) {
18 NOTIMPLEMENTED(); 65 NOTIMPLEMENTED();
19 return false; 66 return false;
20 } 67 }
21 68
69 // TODO(estade): this appears to be unused on Windows. Can we remove it?
22 bool SendKeyDown(wchar_t key) { 70 bool SendKeyDown(wchar_t key) {
23 NOTIMPLEMENTED(); 71 NOTIMPLEMENTED();
24 return false; 72 return false;
25 } 73 }
26 74
75 // TODO(estade): this appears to be unused on Windows. Can we remove it?
27 bool SendKeyUp(wchar_t key) { 76 bool SendKeyUp(wchar_t key) {
28 NOTIMPLEMENTED(); 77 NOTIMPLEMENTED();
29 return false; 78 return false;
30 } 79 }
31 80
32 bool SendMouseMove(long x, long y) { 81 bool SendMouseMove(long x, long y) {
33 NOTIMPLEMENTED(); 82 NOTIMPLEMENTED();
34 return false; 83 return false;
35 } 84 }
36 85
37 void SendMouseMoveNotifyWhenDone(long x, long y, Task* task) { 86 void SendMouseMoveNotifyWhenDone(long x, long y, Task* task) {
38 NOTIMPLEMENTED(); 87 NOTIMPLEMENTED();
39 } 88 }
40 89
41 bool SendMouseClick(MouseButton type) { 90 bool SendMouseClick(gfx::NativeWindow window, const gfx::Point& point,
91 MouseButton type) {
42 NOTIMPLEMENTED(); 92 NOTIMPLEMENTED();
43 return false; 93 return false;
44
45 } 94 }
46 95
47 // TODO(estade): need to figure out a better type for this than View. 96 // TODO(estade): need to figure out a better type for this than View.
48 void MoveMouseToCenterAndPress(views::View* view, 97 void MoveMouseToCenterAndPress(views::View* view,
49 MouseButton button, 98 MouseButton button,
50 int state, 99 int state,
51 Task* task) { 100 Task* task) {
52 NOTIMPLEMENTED(); 101 NOTIMPLEMENTED();
53 } 102 }
54 103
55 } // namespace ui_controls 104 } // namespace ui_controls
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698