| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/message_box_flags.h" | 8 #include "app/message_box_flags.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/json_reader.h" | 10 #include "base/json_reader.h" |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 IPC_MESSAGE_HANDLER(AutomationMsg_IsWindowActive, IsWindowActive) | 943 IPC_MESSAGE_HANDLER(AutomationMsg_IsWindowActive, IsWindowActive) |
| 944 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateWindow, ActivateWindow) | 944 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateWindow, ActivateWindow) |
| 945 #if defined(OS_WIN) | 945 #if defined(OS_WIN) |
| 946 IPC_MESSAGE_HANDLER(AutomationMsg_WindowHWND, GetWindowHWND) | 946 IPC_MESSAGE_HANDLER(AutomationMsg_WindowHWND, GetWindowHWND) |
| 947 #endif // defined(OS_WIN) | 947 #endif // defined(OS_WIN) |
| 948 IPC_MESSAGE_HANDLER(AutomationMsg_WindowExecuteCommandAsync, | 948 IPC_MESSAGE_HANDLER(AutomationMsg_WindowExecuteCommandAsync, |
| 949 ExecuteBrowserCommandAsync) | 949 ExecuteBrowserCommandAsync) |
| 950 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommand, | 950 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommand, |
| 951 ExecuteBrowserCommand) | 951 ExecuteBrowserCommand) |
| 952 IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds) | 952 IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds) |
| 953 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowBounds, SetWindowBounds) |
| 953 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowVisible, SetWindowVisible) | 954 IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowVisible, SetWindowVisible) |
| 954 #if defined(OS_WIN) | 955 #if defined(OS_WIN) |
| 955 IPC_MESSAGE_HANDLER(AutomationMsg_WindowClick, WindowSimulateClick) | 956 IPC_MESSAGE_HANDLER(AutomationMsg_WindowClick, WindowSimulateClick) |
| 956 IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) | 957 IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) |
| 957 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, | 958 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, |
| 958 WindowSimulateDrag) | 959 WindowSimulateDrag) |
| 959 #endif // defined(OS_WIN) | 960 #endif // defined(OS_WIN) |
| 960 IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) | 961 IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) |
| 961 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) | 962 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) |
| 962 #if defined(OS_WIN) | 963 #if defined(OS_WIN) |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1706 HWND hwnd = window_tracker_->GetResource(handle); | 1707 HWND hwnd = window_tracker_->GetResource(handle); |
| 1707 views::FocusManager* focus_manager = | 1708 views::FocusManager* focus_manager = |
| 1708 views::FocusManager::GetFocusManagerForNativeView(hwnd); | 1709 views::FocusManager::GetFocusManagerForNativeView(hwnd); |
| 1709 DCHECK(focus_manager); | 1710 DCHECK(focus_manager); |
| 1710 views::View* focused_view = focus_manager->GetFocusedView(); | 1711 views::View* focused_view = focus_manager->GetFocusedView(); |
| 1711 if (focused_view) | 1712 if (focused_view) |
| 1712 *view_id = focused_view->GetID(); | 1713 *view_id = focused_view->GetID(); |
| 1713 } | 1714 } |
| 1714 } | 1715 } |
| 1715 | 1716 |
| 1717 void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds, |
| 1718 bool* success) { |
| 1719 *success = false; |
| 1720 if (window_tracker_->ContainsHandle(handle)) { |
| 1721 HWND hwnd = window_tracker_->GetResource(handle); |
| 1722 if (::MoveWindow(hwnd, bounds.x(), bounds.y(), bounds.width(), |
| 1723 bounds.height(), true)) { |
| 1724 *success = true; |
| 1725 } |
| 1726 } |
| 1727 } |
| 1728 |
| 1716 void AutomationProvider::SetWindowVisible(int handle, bool visible, | 1729 void AutomationProvider::SetWindowVisible(int handle, bool visible, |
| 1717 bool* result) { | 1730 bool* result) { |
| 1718 if (window_tracker_->ContainsHandle(handle)) { | 1731 if (window_tracker_->ContainsHandle(handle)) { |
| 1719 HWND hwnd = window_tracker_->GetResource(handle); | 1732 HWND hwnd = window_tracker_->GetResource(handle); |
| 1720 ::ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE); | 1733 ::ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE); |
| 1721 *result = true; | 1734 *result = true; |
| 1722 } else { | 1735 } else { |
| 1723 *result = false; | 1736 *result = false; |
| 1724 } | 1737 } |
| 1725 } | 1738 } |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3019 if (container) { | 3032 if (container) { |
| 3020 *count = static_cast<int>(container->GetBlockedPopupCount()); | 3033 *count = static_cast<int>(container->GetBlockedPopupCount()); |
| 3021 } else { | 3034 } else { |
| 3022 // If we don't have a container, we don't have any blocked popups to | 3035 // If we don't have a container, we don't have any blocked popups to |
| 3023 // contain! | 3036 // contain! |
| 3024 *count = 0; | 3037 *count = 0; |
| 3025 } | 3038 } |
| 3026 } | 3039 } |
| 3027 } | 3040 } |
| 3028 } | 3041 } |
| OLD | NEW |