summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver/winrt_utils.cc
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 17:42:32 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 17:42:32 +0000
commit7c3b7003d5f513a2608ec6586901d6367a21b0e6 (patch)
treec50d5350c229404c9e6484e5ac04b5ac44a8544c /win8/metro_driver/winrt_utils.cc
parent3c17ae74d8ead9a9117c7837f832da0d02a225fa (diff)
downloadchromium_src-7c3b7003d5f513a2608ec6586901d6367a21b0e6.zip
chromium_src-7c3b7003d5f513a2608ec6586901d6367a21b0e6.tar.gz
chromium_src-7c3b7003d5f513a2608ec6586901d6367a21b0e6.tar.bz2
Split ash and non-ash metro driver code
ChromeAppViewFactory now produces ChromeAppView or ChromeAppViewAsh depending on the use_aura gyp flag. The two versions have very little in common. Overt time they might share more code. BUG=151718 TEST=see bug Review URL: https://codereview.chromium.org/11233070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver/winrt_utils.cc')
-rw-r--r--win8/metro_driver/winrt_utils.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/win8/metro_driver/winrt_utils.cc b/win8/metro_driver/winrt_utils.cc
index cfddc5e..f00011d 100644
--- a/win8/metro_driver/winrt_utils.cc
+++ b/win8/metro_driver/winrt_utils.cc
@@ -70,6 +70,19 @@ HRESULT Create ## Name ## Property(Type value, \
*result = 0; \
hr = S_OK
+
+BOOL CALLBACK CoreWindowFinder(HWND hwnd, LPARAM param) {
+ HWND* window = reinterpret_cast<HWND*>(param);
+ char classname[128];
+ if (::GetClassNameA(hwnd, classname, ARRAYSIZE(classname))) {
+ if (lstrcmpiA("Windows.UI.Core.CoreWindow", classname) == 0) {
+ *window = hwnd;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
} // namespace
namespace winrt_utils {
@@ -222,4 +235,13 @@ string16 ReadArgumentsFromPinnedTaskbarShortcut() {
return L"";
}
+HWND FindCoreWindow(DWORD thread_id, int wait_ms) {
+ HWND window = NULL;
+ do {
+ ::Sleep(wait_ms);
+ ::EnumThreadWindows(thread_id, &CoreWindowFinder, LPARAM(&window));
+ } while (window == NULL);
+ return window;
+}
+
} // namespace winrt_utils