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

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: CR feedback 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
« no previous file with comments | « remoting/host/plugin/daemon_installer_win.h ('k') | remoting/host/plugin/host_plugin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6eedd967f35bf19166b8eb813557554214c58d11 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(
+ HWND 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(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
« no previous file with comments | « remoting/host/plugin/daemon_installer_win.h ('k') | remoting/host/plugin/host_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698