summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 21:32:30 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 21:32:30 +0000
commita4d271ecbea5ed763d49919fac7bfabe788832f6 (patch)
treec646a4d085142007968138c7ad26d1fb2aafe6a9 /chrome/browser/automation
parent19ff283d0e043c59206fdc2e890a2780933849fe (diff)
downloadchromium_src-a4d271ecbea5ed763d49919fac7bfabe788832f6.zip
chromium_src-a4d271ecbea5ed763d49919fac7bfabe788832f6.tar.gz
chromium_src-a4d271ecbea5ed763d49919fac7bfabe788832f6.tar.bz2
Reverting 27412 it breaks the toolkit views Linux build.
TBR=sky Review URL: http://codereview.chromium.org/254005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/automation_provider.cc5
-rw-r--r--chrome/browser/automation/automation_provider.h2
-rw-r--r--chrome/browser/automation/automation_provider_win.cc3
-rw-r--r--chrome/browser/automation/ui_controls.h18
-rw-r--r--chrome/browser/automation/ui_controls_linux.cc15
-rw-r--r--chrome/browser/automation/ui_controls_win.cc36
6 files changed, 33 insertions, 46 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 627c604..b4fc56d 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -10,7 +10,6 @@
#include "app/message_box_flags.h"
#include "base/file_version_info.h"
#include "base/json_reader.h"
-#include "base/keyboard_codes.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/stl_util-inl.h"
@@ -829,14 +828,14 @@ void AutomationProvider::WindowSimulateClick(const IPC::Message& message,
void AutomationProvider::WindowSimulateKeyPress(const IPC::Message& message,
int handle,
- int key,
+ wchar_t key,
int flags) {
if (!window_tracker_->ContainsHandle(handle))
return;
gfx::NativeWindow window = window_tracker_->GetResource(handle);
// The key event is sent to whatever window is active.
- ui_controls::SendKeyPress(window, static_cast<base::KeyboardCode>(key),
+ ui_controls::SendKeyPress(window, key,
((flags & views::Event::EF_CONTROL_DOWN) ==
views::Event::EF_CONTROL_DOWN),
((flags & views::Event::EF_SHIFT_DOWN) ==
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index be11f91..a376610 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -174,7 +174,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
int flags);
void WindowSimulateKeyPress(const IPC::Message& message,
int handle,
- int key,
+ wchar_t key,
int flags);
void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result);
void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result);
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index f226289..9af097d 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/automation/automation_provider.h"
-#include "base/keyboard_codes.h"
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/external_tab_container.h"
@@ -234,7 +233,7 @@ void AutomationProvider::WindowSimulateDrag(int handle,
if (press_escape_en_route) {
// Press Escape.
- ui_controls::SendKeyPress(window, base::VKEY_ESCAPE,
+ ui_controls::SendKeyPress(window, VK_ESCAPE,
((flags & views::Event::EF_CONTROL_DOWN)
== views::Event::EF_CONTROL_DOWN),
((flags & views::Event::EF_SHIFT_DOWN) ==
diff --git a/chrome/browser/automation/ui_controls.h b/chrome/browser/automation/ui_controls.h
index 4613626..7a7a6d6 100644
--- a/chrome/browser/automation/ui_controls.h
+++ b/chrome/browser/automation/ui_controls.h
@@ -15,7 +15,6 @@
#include "base/gfx/native_widget_types.h"
#include "base/gfx/point.h"
-#include "base/keyboard_codes.h"
#if defined(TOOLKIT_VIEWS)
namespace views {
@@ -43,17 +42,12 @@ namespace ui_controls {
// these functions, so passing NULL is ok.
// Send a key press with/without modifier keys.
-bool SendKeyPress(gfx::NativeWindow window,
- base::KeyboardCode key,
- bool control,
- bool shift,
- bool alt);
-bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
- base::KeyboardCode key,
- bool control,
- bool shift,
- bool alt,
- Task* task);
+// |key| should be a VKEY code as defined in base/keyboard_codes.h
+bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control,
+ bool shift, bool alt);
+bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key,
+ bool control, bool shift,
+ bool alt, Task* task);
// Simulate a mouse move. (x,y) are absolute screen coordinates.
bool SendMouseMove(long x, long y);
diff --git a/chrome/browser/automation/ui_controls_linux.cc b/chrome/browser/automation/ui_controls_linux.cc
index 544816b..738f566 100644
--- a/chrome/browser/automation/ui_controls_linux.cc
+++ b/chrome/browser/automation/ui_controls_linux.cc
@@ -150,7 +150,7 @@ void FakeAMouseMotionEvent(gint x, gint y) {
namespace ui_controls {
bool SendKeyPress(gfx::NativeWindow window,
- base::KeyboardCode key, bool control, bool shift, bool alt) {
+ wchar_t key, bool control, bool shift, bool alt) {
GdkWindow* event_window = NULL;
GtkWidget* grab_widget = gtk_grab_get_current();
if (grab_widget) {
@@ -197,9 +197,9 @@ bool SendKeyPress(gfx::NativeWindow window,
(shift ? GDK_SHIFT_MASK : 0) |
(alt ? GDK_MOD1_MASK : 0);
- guint gdk_key = base::GdkKeyCodeForWindowsKeyCode(key);
- rv = rv && SendKeyEvent(event_window, true, gdk_key, state);
- rv = rv && SendKeyEvent(event_window, false, gdk_key, state);
+ key = base::GdkKeyCodeForWindowsKeyCode(key);
+ rv = rv && SendKeyEvent(event_window, true, key, state);
+ rv = rv && SendKeyEvent(event_window, false, key, state);
if (alt) {
guint state = (control ? GDK_CONTROL_MASK : 0) |
@@ -218,10 +218,9 @@ bool SendKeyPress(gfx::NativeWindow window,
return rv;
}
-bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
- base::KeyboardCode key,
- bool control, bool shift, bool alt,
- Task* task) {
+bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key,
+ bool control, bool shift,
+ bool alt, Task* task) {
int release_count = 1;
if (control)
release_count++;
diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc
index 29ca089..78b1acb 100644
--- a/chrome/browser/automation/ui_controls_win.cc
+++ b/chrome/browser/automation/ui_controls_win.cc
@@ -4,10 +4,8 @@
#include "chrome/browser/automation/ui_controls.h"
-#include "base/keyboard_codes.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/win_util.h"
#include "base/ref_counted.h"
#include "base/task.h"
#include "views/view.h"
@@ -135,18 +133,18 @@ void InputDispatcher::NotifyTask() {
// Populate the INPUT structure with the appropriate keyboard event
// parameters required by SendInput
-bool FillKeyboardInput(base::KeyboardCode key, INPUT* input, bool key_up) {
+bool FillKeyboardInput(wchar_t key, INPUT* input, bool key_up) {
memset(input, 0, sizeof(INPUT));
input->type = INPUT_KEYBOARD;
- input->ki.wVk = win_util::KeyboardCodeToWin(key);
+ input->ki.wVk = static_cast<WORD>(key);
input->ki.dwFlags = key_up ? KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP :
- KEYEVENTF_EXTENDEDKEY;
+ KEYEVENTF_EXTENDEDKEY;
return true;
}
// Send a key event (up/down)
-bool SendKeyEvent(base::KeyboardCode key, bool up) {
+bool SendKeyEvent(wchar_t key, bool up) {
INPUT input = { 0 };
if (!FillKeyboardInput(key, &input, up))
@@ -158,8 +156,7 @@ bool SendKeyEvent(base::KeyboardCode key, bool up) {
return true;
}
-bool SendKeyPressImpl(base::KeyboardCode key,
- bool control, bool shift, bool alt,
+bool SendKeyPressImpl(wchar_t key, bool control, bool shift, bool alt,
Task* task) {
scoped_refptr<InputDispatcher> dispatcher(
task ? new InputDispatcher(task, WM_KEYUP) : NULL);
@@ -168,19 +165,19 @@ bool SendKeyPressImpl(base::KeyboardCode key,
int i = 0;
if (control) {
- if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], false))
+ if (!FillKeyboardInput(VK_CONTROL, &input[i], false))
return false;
i++;
}
if (shift) {
- if (!FillKeyboardInput(base::VKEY_SHIFT, &input[i], false))
+ if (!FillKeyboardInput(VK_SHIFT, &input[i], false))
return false;
i++;
}
if (alt) {
- if (!FillKeyboardInput(base::VKEY_MENU, &input[i], false))
+ if (!FillKeyboardInput(VK_MENU, &input[i], false))
return false;
i++;
}
@@ -194,19 +191,19 @@ bool SendKeyPressImpl(base::KeyboardCode key,
i++;
if (alt) {
- if (!FillKeyboardInput(base::VKEY_MENU, &input[i], true))
+ if (!FillKeyboardInput(VK_MENU, &input[i], true))
return false;
i++;
}
if (shift) {
- if (!FillKeyboardInput(base::VKEY_SHIFT, &input[i], true))
+ if (!FillKeyboardInput(VK_SHIFT, &input[i], true))
return false;
i++;
}
if (control) {
- if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], true))
+ if (!FillKeyboardInput(VK_CONTROL, &input[i], true))
return false;
i++;
}
@@ -307,15 +304,14 @@ bool SendMouseEventsImpl(MouseButton type, int state, Task* task) {
// public functions -----------------------------------------------------------
-bool SendKeyPress(gfx::NativeWindow window, base::KeyboardCode key,
- bool control, bool shift, bool alt) {
+bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control,
+ bool shift, bool alt) {
return SendKeyPressImpl(key, control, shift, alt, NULL);
}
-bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
- base::KeyboardCode key,
- bool control, bool shift, bool alt,
- Task* task) {
+bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key,
+ bool control, bool shift,
+ bool alt, Task* task) {
return SendKeyPressImpl(key, control, shift, alt, task);
}