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

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

Issue 12225111: Make remoting_unittests build on Win64 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/remoting.gyp » ('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/disconnect_window.h" 5 #include "remoting/host/disconnect_window.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 explicit DisconnectWindowWin(const UiStrings* ui_strings); 41 explicit DisconnectWindowWin(const UiStrings* ui_strings);
42 virtual ~DisconnectWindowWin(); 42 virtual ~DisconnectWindowWin();
43 43
44 // DisconnectWindow interface. 44 // DisconnectWindow interface.
45 virtual bool Show(const base::Closure& disconnect_callback, 45 virtual bool Show(const base::Closure& disconnect_callback,
46 const std::string& username) OVERRIDE; 46 const std::string& username) OVERRIDE;
47 virtual void Hide() OVERRIDE; 47 virtual void Hide() OVERRIDE;
48 48
49 private: 49 private:
50 static BOOL CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wparam, 50 static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wparam,
51 LPARAM lparam); 51 LPARAM lparam);
52 52
53 BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 53 BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
54 54
55 // Creates the dialog window and registers the disconnect hot key. 55 // Creates the dialog window and registers the disconnect hot key.
56 bool BeginDialog(const std::string& username); 56 bool BeginDialog(const std::string& username);
57 57
58 // Closes the dialog, unregisters the hot key and invokes the disconnect 58 // Closes the dialog, unregisters the hot key and invokes the disconnect
59 // callback, if set. 59 // callback, if set.
60 void EndDialog(); 60 void EndDialog();
61 61
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return false; 115 return false;
116 } 116 }
117 } 117 }
118 118
119 void DisconnectWindowWin::Hide() { 119 void DisconnectWindowWin::Hide() {
120 // Clear the |disconnect_callback_| so it won't be invoked by EndDialog(). 120 // Clear the |disconnect_callback_| so it won't be invoked by EndDialog().
121 disconnect_callback_.Reset(); 121 disconnect_callback_.Reset();
122 EndDialog(); 122 EndDialog();
123 } 123 }
124 124
125 BOOL CALLBACK DisconnectWindowWin::DialogProc(HWND hwnd, UINT message, 125 INT_PTR CALLBACK DisconnectWindowWin::DialogProc(HWND hwnd, UINT message,
126 WPARAM wparam, LPARAM lparam) { 126 WPARAM wparam, LPARAM lparam) {
127 LONG_PTR self = NULL; 127 LONG_PTR self = NULL;
128 if (message == WM_INITDIALOG) { 128 if (message == WM_INITDIALOG) {
129 self = lparam; 129 self = lparam;
130 130
131 // Store |this| to the window's user data. 131 // Store |this| to the window's user data.
132 SetLastError(ERROR_SUCCESS); 132 SetLastError(ERROR_SUCCESS);
133 LONG_PTR result = SetWindowLongPtr(hwnd, DWLP_USER, self); 133 LONG_PTR result = SetWindowLongPtr(hwnd, DWLP_USER, self);
134 if (result == 0 && GetLastError() != ERROR_SUCCESS) 134 if (result == 0 && GetLastError() != ERROR_SUCCESS)
135 reinterpret_cast<DisconnectWindowWin*>(self)->EndDialog(); 135 reinterpret_cast<DisconnectWindowWin*>(self)->EndDialog();
136 } else { 136 } else {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return TRUE; 182 return TRUE;
183 183
184 // Handle the disconnect hot-key. 184 // Handle the disconnect hot-key.
185 case WM_HOTKEY: 185 case WM_HOTKEY:
186 EndDialog(); 186 EndDialog();
187 return TRUE; 187 return TRUE;
188 188
189 // Let the window be draggable by its client area by responding 189 // Let the window be draggable by its client area by responding
190 // that the entire window is the title bar. 190 // that the entire window is the title bar.
191 case WM_NCHITTEST: 191 case WM_NCHITTEST:
192 SetWindowLong(hwnd, DWL_MSGRESULT, HTCAPTION); 192 SetWindowLongPtr(hwnd, DWLP_MSGRESULT, HTCAPTION);
193 return TRUE; 193 return TRUE;
194 194
195 case WM_PAINT: { 195 case WM_PAINT: {
196 PAINTSTRUCT ps; 196 PAINTSTRUCT ps;
197 HDC hdc = BeginPaint(hwnd_, &ps); 197 HDC hdc = BeginPaint(hwnd_, &ps);
198 RECT rect; 198 RECT rect;
199 GetClientRect(hwnd_, &rect); 199 GetClientRect(hwnd_, &rect);
200 { 200 {
201 base::win::ScopedSelectObject border(hdc, border_pen_); 201 base::win::ScopedSelectObject border(hdc, border_pen_);
202 base::win::ScopedSelectObject brush(hdc, GetStockObject(NULL_BRUSH)); 202 base::win::ScopedSelectObject brush(hdc, GetStockObject(NULL_BRUSH));
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 return true; 385 return true;
386 } 386 }
387 387
388 scoped_ptr<DisconnectWindow> DisconnectWindow::Create( 388 scoped_ptr<DisconnectWindow> DisconnectWindow::Create(
389 const UiStrings* ui_strings) { 389 const UiStrings* ui_strings) {
390 return scoped_ptr<DisconnectWindow>(new DisconnectWindowWin(ui_strings)); 390 return scoped_ptr<DisconnectWindow>(new DisconnectWindowWin(ui_strings));
391 } 391 }
392 392
393 } // namespace remoting 393 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698