Chromium Code Reviews| Index: ui/views/win/hwnd_message_handler.cc |
| diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc |
| index a58c5f73ed84f641a44d043652cd2939c1d5d7cd..44e5af33fe51d6e9f6ba539b07891b597997a8b4 100644 |
| --- a/ui/views/win/hwnd_message_handler.cc |
| +++ b/ui/views/win/hwnd_message_handler.cc |
| @@ -195,9 +195,16 @@ bool GetMonitorAndRects(const RECT& rect, |
| struct FindOwnedWindowsData { |
| HWND window; |
| - std::vector<Widget*> owned_widgets; |
| + std::vector<HWND> owned_windows; |
| }; |
|
tapted
2017/01/25 11:23:03
(this struct was orphaned, but it was a handy link
|
| +BOOL CALLBACK FindOwnedWindowsCallback(HWND hwnd, LPARAM param) { |
| + FindOwnedWindowsData* data = reinterpret_cast<FindOwnedWindowsData*>(param); |
| + if (GetWindow(hwnd, GW_OWNER) == data->window) |
| + data->owned_windows.push_back(hwnd); |
| + return TRUE; |
| +} |
| + |
| // Enables or disables the menu item for the specified command and menu. |
| void EnableMenuItemByCommand(HMENU menu, UINT command, bool enabled) { |
| UINT flags = MF_BYCOMMAND | (enabled ? MF_ENABLED : MF_DISABLED | MF_GRAYED); |
| @@ -477,6 +484,15 @@ gfx::Rect HWNDMessageHandler::GetClientAreaBounds() const { |
| return GetWindowBoundsInScreen(); |
| } |
| +std::vector<HWND> HWNDMessageHandler::GetOwnedWindows() const { |
| + FindOwnedWindowsData data; |
| + data.window = hwnd(); |
| + // The Windows API also offers EnumChildWindows(..), but it doesn't work. |
| + EnumThreadWindows(GetCurrentThreadId(), FindOwnedWindowsCallback, |
| + reinterpret_cast<LPARAM>(&data)); |
| + return data.owned_windows; |
| +} |
| + |
| void HWNDMessageHandler::GetWindowPlacement( |
| gfx::Rect* bounds, |
| ui::WindowShowState* show_state) const { |