Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 2645253002: DesktopAura: Track windows "owned" via the DesktopWindowTreeHost (Closed)
Patch Set: Add context, comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
+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 {
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698