| 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) |
| 306 IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) | 307 IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) |
| 307 #endif // !defined(OS_MACOSX) | 308 #endif // !defined(OS_MACOSX) |
| 308 #if defined(OS_WIN) || defined(OS_LINUX) | 309 #if defined(OS_WIN) || defined(OS_LINUX) |
| 309 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, | 310 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, |
| 310 WindowSimulateDrag) | 311 WindowSimulateDrag) |
| 311 #endif // defined(OS_WIN) || defined(OS_LINUX) | 312 #endif // defined(OS_WIN) || defined(OS_LINUX) |
| 312 IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) | 313 IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) |
| 313 IPC_MESSAGE_HANDLER(AutomationMsg_Type, GetType) | 314 IPC_MESSAGE_HANDLER(AutomationMsg_Type, GetType) |
| 314 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) | 315 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) |
| 315 #if defined(OS_WIN) | 316 #if defined(OS_WIN) |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 void AutomationProvider::WindowSimulateClick(const IPC::Message& message, | 839 void AutomationProvider::WindowSimulateClick(const IPC::Message& message, |
| 839 int handle, | 840 int handle, |
| 840 const gfx::Point& click, | 841 const gfx::Point& click, |
| 841 int flags) { | 842 int flags) { |
| 842 if (window_tracker_->ContainsHandle(handle)) { | 843 if (window_tracker_->ContainsHandle(handle)) { |
| 843 ui_controls::SendMouseMoveNotifyWhenDone(click.x(), click.y(), | 844 ui_controls::SendMouseMoveNotifyWhenDone(click.x(), click.y(), |
| 844 new ClickTask(flags)); | 845 new ClickTask(flags)); |
| 845 } | 846 } |
| 846 } | 847 } |
| 847 | 848 |
| 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 |
| 848 void AutomationProvider::WindowSimulateKeyPress(const IPC::Message& message, | 856 void AutomationProvider::WindowSimulateKeyPress(const IPC::Message& message, |
| 849 int handle, | 857 int handle, |
| 850 int key, | 858 int key, |
| 851 int flags) { | 859 int flags) { |
| 852 if (!window_tracker_->ContainsHandle(handle)) | 860 if (!window_tracker_->ContainsHandle(handle)) |
| 853 return; | 861 return; |
| 854 | 862 |
| 855 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 863 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
| 856 // The key event is sent to whatever window is active. | 864 // The key event is sent to whatever window is active. |
| 857 ui_controls::SendKeyPress(window, static_cast<base::KeyboardCode>(key), | 865 ui_controls::SendKeyPress(window, static_cast<base::KeyboardCode>(key), |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 reply_message); | 2185 reply_message); |
| 2178 | 2186 |
| 2179 profile_->GetExtensionsService()->LoadExtension(extension_dir); | 2187 profile_->GetExtensionsService()->LoadExtension(extension_dir); |
| 2180 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); | 2188 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); |
| 2181 } else { | 2189 } else { |
| 2182 AutomationMsg_LoadExpandedExtension::WriteReplyParams( | 2190 AutomationMsg_LoadExpandedExtension::WriteReplyParams( |
| 2183 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); | 2191 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); |
| 2184 Send(reply_message); | 2192 Send(reply_message); |
| 2185 } | 2193 } |
| 2186 } | 2194 } |
| OLD | NEW |