Index: webkit/tools/test_shell/event_sending_controller.cc |
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc |
index bf028356bb8c14e4ffa9eb8f910e5f1de59c0d96..12cb0f70b76bddbe3d16c25904315b35de8e16e4 100644 |
--- a/webkit/tools/test_shell/event_sending_controller.cc |
+++ b/webkit/tools/test_shell/event_sending_controller.cc |
@@ -149,19 +149,18 @@ void InitMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b, |
} |
// Returns true if the specified key is the system key. |
-bool ApplyKeyModifier(const std::wstring& arg, WebInputEvent* event) { |
+bool ApplyKeyModifier(const std::string& key, WebInputEvent* event) { |
bool system_key = false; |
- const wchar_t* arg_string = arg.c_str(); |
- if (!wcscmp(arg_string, L"ctrlKey") |
+ if (key == "ctrlKey" |
#if !defined(OS_MACOSX) |
- || !wcscmp(arg_string, L"addSelectionKey") |
+ || key == "addSelectionKey" |
#endif |
) { |
event->modifiers |= WebInputEvent::ControlKey; |
- } else if (!wcscmp(arg_string, L"shiftKey") |
- || !wcscmp(arg_string, L"rangeSelectionKey")) { |
+ } else if (key == "shiftKey" |
viettrungluu
2010/12/03 02:00:16
Nit: reformat with standard style?
|
+ || key == "rangeSelectionKey") { |
event->modifiers |= WebInputEvent::ShiftKey; |
- } else if (!wcscmp(arg_string, L"altKey")) { |
+ } else if (key == "altKey") { |
event->modifiers |= WebInputEvent::AltKey; |
#if !defined(OS_MACOSX) |
// On Windows all keys with Alt modifier will be marked as system key. |
@@ -172,8 +171,8 @@ bool ApplyKeyModifier(const std::wstring& arg, WebInputEvent* event) { |
system_key = true; |
#endif |
#if defined(OS_MACOSX) |
- } else if (!wcscmp(arg_string, L"metaKey") |
- || !wcscmp(arg_string, L"addSelectionKey")) { |
+ } else if (key == "metaKey" |
viettrungluu
2010/12/03 02:00:16
"
|
+ || key == "addSelectionKey") { |
event->modifiers |= WebInputEvent::MetaKey; |
// On Mac only command key presses are marked as system key. |
// See the related code in: |
@@ -181,7 +180,7 @@ bool ApplyKeyModifier(const std::wstring& arg, WebInputEvent* event) { |
// It must be kept in sync with the related code in above file. |
system_key = true; |
#else |
- } else if (!wcscmp(arg_string, L"metaKey")) { |
+ } else if (key == "metaKey") { |
event->modifiers |= WebInputEvent::MetaKey; |
#endif |
} |
@@ -191,13 +190,13 @@ bool ApplyKeyModifier(const std::wstring& arg, WebInputEvent* event) { |
bool ApplyKeyModifiers(const CppVariant* arg, WebInputEvent* event) { |
bool system_key = false; |
if (arg->isObject()) { |
- std::vector<std::wstring> args = arg->ToStringVector(); |
- for (std::vector<std::wstring>::const_iterator i = args.begin(); |
+ std::vector<std::string> args = arg->ToStringVector(); |
+ for (std::vector<std::string>::const_iterator i = args.begin(); |
i != args.end(); ++i) { |
system_key |= ApplyKeyModifier(*i, event); |
} |
} else if (arg->isString()) { |
- system_key = ApplyKeyModifier(UTF8ToWide(arg->ToString()), event); |
+ system_key = ApplyKeyModifier(arg->ToString(), event); |
} |
return system_key; |
} |
@@ -863,9 +862,10 @@ void EventSendingController::scheduleAsynchronousClick( |
void EventSendingController::beginDragWithFiles( |
const CppArgumentList& args, CppVariant* result) { |
current_drag_data.initialize(); |
- std::vector<std::wstring> files = args[0].ToStringVector(); |
+ std::vector<std::string> files = args[0].ToStringVector(); |
for (size_t i = 0; i < files.size(); ++i) { |
- FilePath file_path = FilePath::FromWStringHack(files[i]); |
+ std::wstring file = UTF8ToWide(files[i]); |
+ FilePath file_path = FilePath::FromWStringHack(file); |
file_util::AbsolutePath(&file_path); |
current_drag_data.appendToFilenames( |
webkit_glue::FilePathStringToWebString(file_path.value())); |