| Index: remoting/host/plugin/daemon_installer_win.cc
|
| diff --git a/remoting/host/plugin/daemon_installer_win.cc b/remoting/host/plugin/daemon_installer_win.cc
|
| index 9d7e524f81f9362b25fdacac4f9b9e0b93563531..365194e41f1aca65c5ba8ac3525983b1689bbb3a 100644
|
| --- a/remoting/host/plugin/daemon_installer_win.cc
|
| +++ b/remoting/host/plugin/daemon_installer_win.cc
|
| @@ -332,12 +332,13 @@ void DaemonInstallerWin::Done(HRESULT result) {
|
|
|
| // static
|
| scoped_ptr<DaemonInstallerWin> DaemonInstallerWin::Create(
|
| + void* window_handle,
|
| CompletionCallback done) {
|
| // Check if the machine instance of Omaha is available.
|
| BIND_OPTS3 bind_options;
|
| memset(&bind_options, 0, sizeof(bind_options));
|
| bind_options.cbStruct = sizeof(bind_options);
|
| - bind_options.hwnd = NULL;
|
| + bind_options.hwnd = GetTopLevelWindow(reinterpret_cast<HWND>(window_handle));
|
| bind_options.dwClassContext = CLSCTX_LOCAL_SERVER;
|
|
|
| ScopedComPtr<omaha::IGoogleUpdate3Web> update3;
|
| @@ -365,4 +366,25 @@ scoped_ptr<DaemonInstallerWin> DaemonInstallerWin::Create(
|
| }
|
| }
|
|
|
| +HWND GetTopLevelWindow(HWND window) {
|
| + if (window == NULL) {
|
| + return NULL;
|
| + }
|
| +
|
| + for (;;) {
|
| + LONG style = GetWindowLong(window, GWL_STYLE);
|
| + if ((style & WS_OVERLAPPEDWINDOW) == WS_OVERLAPPEDWINDOW ||
|
| + (style & WS_POPUP) == WS_POPUP) {
|
| + return window;
|
| + }
|
| +
|
| + HWND parent = GetAncestor(window, GA_PARENT);
|
| + if (parent == NULL) {
|
| + return window;
|
| + }
|
| +
|
| + window = parent;
|
| + }
|
| +}
|
| +
|
| } // namespace remoting
|
|
|