Index: ui/base/win/hwnd_util.cc |
=================================================================== |
--- ui/base/win/hwnd_util.cc (revision 134777) |
+++ ui/base/win/hwnd_util.cc (working copy) |
@@ -6,6 +6,7 @@ |
#include "base/i18n/rtl.h" |
#include "base/string_util.h" |
+#include "base/win/metro.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/size.h" |
@@ -181,4 +182,18 @@ |
SendMessage(window, WM_SYSCOMMAND, command, 0); |
} |
+extern "C" { |
+ typedef HWND (*RootWindow)(); |
+} |
+ |
+HWND GetWindowToParentTo(bool get_real_hwnd) { |
+ HMODULE metro = base::win::GetMetroModule(); |
+ if (!metro) |
+ return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; |
+ // In windows 8 metro-mode the root window is not the desktop. |
+ RootWindow root_window = |
+ reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); |
+ return root_window(); |
+} |
+ |
} // namespace ui |