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

Unified Diff: remoting/host/plugin/daemon_installer_win.cc

Issue 10161034: Making sure that UAC promts fired by the Chromoting plugin get focus (instead of being shown in the… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A fixup Created 8 years, 8 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
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

Powered by Google App Engine
This is Rietveld 408576698