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

Side by Side Diff: remoting/host/it2me/it2me_confirmation_dialog_win.cc

Issue 2418613003: Adding 'Always on top' behavior to the It2Me Confirmation Dialog (Closed)
Patch Set: Updating comments Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windows.h> 5 #include <windows.h>
6 #include <commctrl.h> 6 #include <commctrl.h>
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // flash the placeholder on the taskbar. Do not call SetForegroundWindow() 196 // flash the placeholder on the taskbar. Do not call SetForegroundWindow()
197 // multiple times as it will cause annoying flashing for the user. 197 // multiple times as it will cause annoying flashing for the user.
198 It2MeConfirmationDialogWin* dialog = 198 It2MeConfirmationDialogWin* dialog =
199 reinterpret_cast<It2MeConfirmationDialogWin*>(ref_data); 199 reinterpret_cast<It2MeConfirmationDialogWin*>(ref_data);
200 if (hwnd == GetForegroundWindow()) { 200 if (hwnd == GetForegroundWindow()) {
201 dialog->is_foreground_window_ = true; 201 dialog->is_foreground_window_ = true;
202 } else if (dialog->is_foreground_window_) { 202 } else if (dialog->is_foreground_window_) {
203 SetForegroundWindow(hwnd); 203 SetForegroundWindow(hwnd);
204 dialog->is_foreground_window_ = false; 204 dialog->is_foreground_window_ = false;
205 } 205 }
206
207 if (!dialog->is_foreground_window_) {
208 // Ensure the dialog is always at the top of the top-most window stack,
209 // even if it doesn't have focus, so the user can always see it.
210 BringWindowToTop(hwnd);
211 }
212 } else if (notification == TDN_CREATED) {
213 // After the dialog has been created, but before it is visible, set its
214 // z-order so it will be a top-most window and have always on top behavior.
215 if (!SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
216 SWP_NOMOVE | SWP_NOSIZE)) {
217 PLOG(ERROR) << "SetWindowPos() failed";
218 }
206 } 219 }
207 220
208 return S_OK; 221 return S_OK;
209 } 222 }
210 223
211 } // namespace 224 } // namespace
212 225
213 // static 226 // static
214 std::unique_ptr<It2MeConfirmationDialog> It2MeConfirmationDialog::Create() { 227 std::unique_ptr<It2MeConfirmationDialog> It2MeConfirmationDialog::Create() {
215 return base::MakeUnique<It2MeConfirmationDialogWin>(); 228 return base::MakeUnique<It2MeConfirmationDialogWin>();
216 } 229 }
217 230
218 } // namespace remoting 231 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698