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

Side by Side Diff: remoting/host/continue_window_win.cc

Issue 2911893003: Deprecate NonThreadSafe in remoting in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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 | « remoting/host/continue_window_mac.mm ('k') | remoting/host/disconnect_window_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/continue_window.h" 5 #include "remoting/host/continue_window.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 ContinueWindowWin::ContinueWindowWin() 48 ContinueWindowWin::ContinueWindowWin()
49 : hwnd_(nullptr) { 49 : hwnd_(nullptr) {
50 } 50 }
51 51
52 ContinueWindowWin::~ContinueWindowWin() { 52 ContinueWindowWin::~ContinueWindowWin() {
53 EndDialog(); 53 EndDialog();
54 } 54 }
55 55
56 void ContinueWindowWin::ShowUi() { 56 void ContinueWindowWin::ShowUi() {
57 DCHECK(CalledOnValidThread()); 57 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
58 DCHECK(!hwnd_); 58 DCHECK(!hwnd_);
59 59
60 hwnd_ = CreateDialogParam(CURRENT_MODULE(), MAKEINTRESOURCE(IDD_CONTINUE), 60 hwnd_ = CreateDialogParam(CURRENT_MODULE(), MAKEINTRESOURCE(IDD_CONTINUE),
61 nullptr, (DLGPROC)DialogProc, (LPARAM) this); 61 nullptr, (DLGPROC)DialogProc, (LPARAM) this);
62 if (!hwnd_) { 62 if (!hwnd_) {
63 LOG(ERROR) << "Unable to create Disconnect dialog for remoting."; 63 LOG(ERROR) << "Unable to create Disconnect dialog for remoting.";
64 return; 64 return;
65 } 65 }
66 66
67 ShowWindow(hwnd_, SW_SHOW); 67 ShowWindow(hwnd_, SW_SHOW);
68 } 68 }
69 69
70 void ContinueWindowWin::HideUi() { 70 void ContinueWindowWin::HideUi() {
71 DCHECK(CalledOnValidThread()); 71 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
72 72
73 EndDialog(); 73 EndDialog();
74 } 74 }
75 75
76 BOOL CALLBACK ContinueWindowWin::DialogProc(HWND hwnd, UINT msg, 76 BOOL CALLBACK ContinueWindowWin::DialogProc(HWND hwnd, UINT msg,
77 WPARAM wParam, LPARAM lParam) { 77 WPARAM wParam, LPARAM lParam) {
78 ContinueWindowWin* win = nullptr; 78 ContinueWindowWin* win = nullptr;
79 if (msg == WM_INITDIALOG) { 79 if (msg == WM_INITDIALOG) {
80 win = reinterpret_cast<ContinueWindowWin*>(lParam); 80 win = reinterpret_cast<ContinueWindowWin*>(lParam);
81 CHECK(win); 81 CHECK(win);
82 SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)win); 82 SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)win);
83 } else { 83 } else {
84 LONG_PTR lp = GetWindowLongPtr(hwnd, DWLP_USER); 84 LONG_PTR lp = GetWindowLongPtr(hwnd, DWLP_USER);
85 win = reinterpret_cast<ContinueWindowWin*>(lp); 85 win = reinterpret_cast<ContinueWindowWin*>(lp);
86 } 86 }
87 if (win == nullptr) 87 if (win == nullptr)
88 return FALSE; 88 return FALSE;
89 return win->OnDialogMessage(hwnd, msg, wParam, lParam); 89 return win->OnDialogMessage(hwnd, msg, wParam, lParam);
90 } 90 }
91 91
92 BOOL ContinueWindowWin::OnDialogMessage(HWND hwnd, UINT msg, 92 BOOL ContinueWindowWin::OnDialogMessage(HWND hwnd, UINT msg,
93 WPARAM wParam, LPARAM lParam) { 93 WPARAM wParam, LPARAM lParam) {
94 DCHECK(CalledOnValidThread()); 94 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
95 95
96 switch (msg) { 96 switch (msg) {
97 case WM_CLOSE: 97 case WM_CLOSE:
98 // Ignore close messages. 98 // Ignore close messages.
99 return TRUE; 99 return TRUE;
100 case WM_DESTROY: 100 case WM_DESTROY:
101 // Ensure we don't try to use the HWND anymore. 101 // Ensure we don't try to use the HWND anymore.
102 hwnd_ = nullptr; 102 hwnd_ = nullptr;
103 return TRUE; 103 return TRUE;
104 case WM_COMMAND: 104 case WM_COMMAND:
105 switch (LOWORD(wParam)) { 105 switch (LOWORD(wParam)) {
106 case IDC_CONTINUE_DEFAULT: 106 case IDC_CONTINUE_DEFAULT:
107 ContinueSession(); 107 ContinueSession();
108 ::EndDialog(hwnd, LOWORD(wParam)); 108 ::EndDialog(hwnd, LOWORD(wParam));
109 hwnd_ = nullptr; 109 hwnd_ = nullptr;
110 return TRUE; 110 return TRUE;
111 case IDC_CONTINUE_CANCEL: 111 case IDC_CONTINUE_CANCEL:
112 DisconnectSession(); 112 DisconnectSession();
113 ::EndDialog(hwnd, LOWORD(wParam)); 113 ::EndDialog(hwnd, LOWORD(wParam));
114 hwnd_ = nullptr; 114 hwnd_ = nullptr;
115 return TRUE; 115 return TRUE;
116 } 116 }
117 } 117 }
118 return FALSE; 118 return FALSE;
119 } 119 }
120 120
121 void ContinueWindowWin::EndDialog() { 121 void ContinueWindowWin::EndDialog() {
122 DCHECK(CalledOnValidThread()); 122 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
123 123
124 if (hwnd_) { 124 if (hwnd_) {
125 ::DestroyWindow(hwnd_); 125 ::DestroyWindow(hwnd_);
126 hwnd_ = nullptr; 126 hwnd_ = nullptr;
127 } 127 }
128 } 128 }
129 129
130 } // namespace 130 } // namespace
131 131
132 // static 132 // static
133 std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() { 133 std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
134 return base::MakeUnique<ContinueWindowWin>(); 134 return base::MakeUnique<ContinueWindowWin>();
135 } 135 }
136 136
137 } // namespace remoting 137 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/continue_window_mac.mm ('k') | remoting/host/disconnect_window_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698