| OLD | NEW |
| 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/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 ExecuteBrowserCommandAsync) | 296 ExecuteBrowserCommandAsync) |
| 297 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommand, | 297 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommand, |
| 298 ExecuteBrowserCommand) | 298 ExecuteBrowserCommand) |
| 299 IPC_MESSAGE_HANDLER(AutomationMsg_TerminateSession, TerminateSession) | 299 IPC_MESSAGE_HANDLER(AutomationMsg_TerminateSession, TerminateSession) |
| 300 IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds) | 300 IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds) |
| 301 IPC_MESSAGE_HANDLER(AutomationMsg_GetWindowBounds, GetWindowBounds) | 301 IPC_MESSAGE_HANDLER(AutomationMsg_GetWindowBounds, GetWindowBounds) |
| 302 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowBounds, SetWindowBounds) | 302 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowBounds, SetWindowBounds) |
| 303 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowVisible, SetWindowVisible) | 303 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowVisible, SetWindowVisible) |
| 304 #if !defined(OS_MACOSX) | 304 #if !defined(OS_MACOSX) |
| 305 IPC_MESSAGE_HANDLER(AutomationMsg_WindowClick, WindowSimulateClick) | 305 IPC_MESSAGE_HANDLER(AutomationMsg_WindowClick, WindowSimulateClick) |
| 306 IPC_MESSAGE_HANDLER(AutomationMsg_WindowMouseMove, WindowSimulateMouseMove) | |
| 307 IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) | 306 IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) |
| 308 #endif // !defined(OS_MACOSX) | 307 #endif // !defined(OS_MACOSX) |
| 309 #if defined(OS_WIN) || defined(OS_LINUX) | 308 #if defined(OS_WIN) || defined(OS_LINUX) |
| 310 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, | 309 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, |
| 311 WindowSimulateDrag) | 310 WindowSimulateDrag) |
| 312 #endif // defined(OS_WIN) || defined(OS_LINUX) | 311 #endif // defined(OS_WIN) || defined(OS_LINUX) |
| 313 IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) | 312 IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) |
| 314 IPC_MESSAGE_HANDLER(AutomationMsg_Type, GetType) | 313 IPC_MESSAGE_HANDLER(AutomationMsg_Type, GetType) |
| 315 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) | 314 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) |
| 316 #if defined(OS_WIN) | 315 #if defined(OS_WIN) |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 void AutomationProvider::WindowSimulateClick(const IPC::Message& message, | 838 void AutomationProvider::WindowSimulateClick(const IPC::Message& message, |
| 840 int handle, | 839 int handle, |
| 841 const gfx::Point& click, | 840 const gfx::Point& click, |
| 842 int flags) { | 841 int flags) { |
| 843 if (window_tracker_->ContainsHandle(handle)) { | 842 if (window_tracker_->ContainsHandle(handle)) { |
| 844 ui_controls::SendMouseMoveNotifyWhenDone(click.x(), click.y(), | 843 ui_controls::SendMouseMoveNotifyWhenDone(click.x(), click.y(), |
| 845 new ClickTask(flags)); | 844 new ClickTask(flags)); |
| 846 } | 845 } |
| 847 } | 846 } |
| 848 | 847 |
| 849 void AutomationProvider::WindowSimulateMouseMove(const IPC::Message& message, | |
| 850 int handle, | |
| 851 const gfx::Point& location) { | |
| 852 if (window_tracker_->ContainsHandle(handle)) | |
| 853 ui_controls::SendMouseMove(location.x(), location.y()); | |
| 854 } | |
| 855 | |
| 856 void AutomationProvider::WindowSimulateKeyPress(const IPC::Message& message, | 848 void AutomationProvider::WindowSimulateKeyPress(const IPC::Message& message, |
| 857 int handle, | 849 int handle, |
| 858 int key, | 850 int key, |
| 859 int flags) { | 851 int flags) { |
| 860 if (!window_tracker_->ContainsHandle(handle)) | 852 if (!window_tracker_->ContainsHandle(handle)) |
| 861 return; | 853 return; |
| 862 | 854 |
| 863 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 855 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
| 864 // The key event is sent to whatever window is active. | 856 // The key event is sent to whatever window is active. |
| 865 ui_controls::SendKeyPress(window, static_cast<base::KeyboardCode>(key), | 857 ui_controls::SendKeyPress(window, static_cast<base::KeyboardCode>(key), |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 reply_message); | 2177 reply_message); |
| 2186 | 2178 |
| 2187 profile_->GetExtensionsService()->LoadExtension(extension_dir); | 2179 profile_->GetExtensionsService()->LoadExtension(extension_dir); |
| 2188 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); | 2180 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); |
| 2189 } else { | 2181 } else { |
| 2190 AutomationMsg_LoadExpandedExtension::WriteReplyParams( | 2182 AutomationMsg_LoadExpandedExtension::WriteReplyParams( |
| 2191 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); | 2183 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); |
| 2192 Send(reply_message); | 2184 Send(reply_message); |
| 2193 } | 2185 } |
| 2194 } | 2186 } |
| OLD | NEW |