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

Side by Side Diff: ui/views/win/hwnd_message_handler.h

Issue 146833020: Remove some uses of ATL in UI code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | « ui/gfx/win/window_impl.h ('k') | ui/views/win/hwnd_message_handler.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 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <atlbase.h>
10 #include <atlapp.h>
11 #include <atlmisc.h>
12 9
13 #include <set> 10 #include <set>
14 #include <vector> 11 #include <vector>
15 12
16 #include "base/basictypes.h" 13 #include "base/basictypes.h"
17 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
18 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
20 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
21 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 void RedrawLayeredWindowContents(); 282 void RedrawLayeredWindowContents();
286 283
287 // Attempts to force the window to be redrawn, ensuring that it gets 284 // Attempts to force the window to be redrawn, ensuring that it gets
288 // onscreen. 285 // onscreen.
289 void ForceRedrawWindow(int attempts); 286 void ForceRedrawWindow(int attempts);
290 287
291 // Message Handlers ---------------------------------------------------------- 288 // Message Handlers ----------------------------------------------------------
292 289
293 BEGIN_SAFE_MSG_MAP_EX(HWNDMessageHandler) 290 BEGIN_SAFE_MSG_MAP_EX(HWNDMessageHandler)
294 // Range handlers must go first! 291 // Range handlers must go first!
295 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) 292 CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
296 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) 293 CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE,
294 WM_NCXBUTTONDBLCLK,
295 OnMouseRange)
297 296
298 // CustomFrameWindow hacks 297 // CustomFrameWindow hacks
299 MESSAGE_HANDLER_EX(WM_NCUAHDRAWCAPTION, OnNCUAHDrawCaption) 298 CR_MESSAGE_HANDLER_EX(WM_NCUAHDRAWCAPTION, OnNCUAHDrawCaption)
300 MESSAGE_HANDLER_EX(WM_NCUAHDRAWFRAME, OnNCUAHDrawFrame) 299 CR_MESSAGE_HANDLER_EX(WM_NCUAHDRAWFRAME, OnNCUAHDrawFrame)
301 300
302 // Vista and newer 301 // Vista and newer
303 MESSAGE_HANDLER_EX(WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged) 302 CR_MESSAGE_HANDLER_EX(WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged)
304 303
305 // Non-atlcrack.h handlers 304 // Non-atlcrack.h handlers
306 MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject) 305 CR_MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject)
307 306
308 // Mouse events. 307 // Mouse events.
309 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate) 308 CR_MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate)
310 MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseRange) 309 CR_MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseRange)
311 MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseRange) 310 CR_MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseRange)
312 MESSAGE_HANDLER_EX(WM_SETCURSOR, OnSetCursor); 311 CR_MESSAGE_HANDLER_EX(WM_SETCURSOR, OnSetCursor);
313 312
314 // Key events. 313 // Key events.
315 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent) 314 CR_MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent)
316 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent) 315 CR_MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent)
317 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent) 316 CR_MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent)
318 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent) 317 CR_MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent)
319 318
320 // IME Events. 319 // IME Events.
321 MESSAGE_HANDLER_EX(WM_IME_SETCONTEXT, OnImeMessages) 320 CR_MESSAGE_HANDLER_EX(WM_IME_SETCONTEXT, OnImeMessages)
322 MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeMessages) 321 CR_MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeMessages)
323 MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeMessages) 322 CR_MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeMessages)
324 MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeMessages) 323 CR_MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeMessages)
325 MESSAGE_HANDLER_EX(WM_IME_REQUEST, OnImeMessages) 324 CR_MESSAGE_HANDLER_EX(WM_IME_REQUEST, OnImeMessages)
326 MESSAGE_HANDLER_EX(WM_IME_NOTIFY, OnImeMessages) 325 CR_MESSAGE_HANDLER_EX(WM_IME_NOTIFY, OnImeMessages)
327 MESSAGE_HANDLER_EX(WM_CHAR, OnImeMessages) 326 CR_MESSAGE_HANDLER_EX(WM_CHAR, OnImeMessages)
328 MESSAGE_HANDLER_EX(WM_SYSCHAR, OnImeMessages) 327 CR_MESSAGE_HANDLER_EX(WM_SYSCHAR, OnImeMessages)
329 MESSAGE_HANDLER_EX(WM_DEADCHAR, OnImeMessages) 328 CR_MESSAGE_HANDLER_EX(WM_DEADCHAR, OnImeMessages)
330 MESSAGE_HANDLER_EX(WM_SYSDEADCHAR, OnImeMessages) 329 CR_MESSAGE_HANDLER_EX(WM_SYSDEADCHAR, OnImeMessages)
331 330
332 // Scroll events 331 // Scroll events
333 MESSAGE_HANDLER_EX(WM_VSCROLL, OnScrollMessage) 332 CR_MESSAGE_HANDLER_EX(WM_VSCROLL, OnScrollMessage)
334 MESSAGE_HANDLER_EX(WM_HSCROLL, OnScrollMessage) 333 CR_MESSAGE_HANDLER_EX(WM_HSCROLL, OnScrollMessage)
335 334
336 // Touch Events. 335 // Touch Events.
337 MESSAGE_HANDLER_EX(WM_TOUCH, OnTouchEvent) 336 CR_MESSAGE_HANDLER_EX(WM_TOUCH, OnTouchEvent)
338 337
339 // Uses the general handler macro since the specific handler macro 338 // Uses the general handler macro since the specific handler macro
340 // MSG_WM_NCACTIVATE would convert WPARAM type to BOOL type. The high 339 // MSG_WM_NCACTIVATE would convert WPARAM type to BOOL type. The high
341 // word of WPARAM could be set when the window is minimized or restored. 340 // word of WPARAM could be set when the window is minimized or restored.
342 MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate) 341 CR_MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate)
343 342
344 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU. 343 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU.
345 MSG_WM_ACTIVATEAPP(OnActivateApp) 344 CR_MSG_WM_ACTIVATEAPP(OnActivateApp)
346 MSG_WM_APPCOMMAND(OnAppCommand) 345 CR_MSG_WM_APPCOMMAND(OnAppCommand)
347 MSG_WM_CANCELMODE(OnCancelMode) 346 CR_MSG_WM_CANCELMODE(OnCancelMode)
348 MSG_WM_CAPTURECHANGED(OnCaptureChanged) 347 CR_MSG_WM_CAPTURECHANGED(OnCaptureChanged)
349 MSG_WM_CLOSE(OnClose) 348 CR_MSG_WM_CLOSE(OnClose)
350 MSG_WM_COMMAND(OnCommand) 349 CR_MSG_WM_COMMAND(OnCommand)
351 MSG_WM_CREATE(OnCreate) 350 CR_MSG_WM_CREATE(OnCreate)
352 MSG_WM_DESTROY(OnDestroy) 351 CR_MSG_WM_DESTROY(OnDestroy)
353 MSG_WM_DISPLAYCHANGE(OnDisplayChange) 352 CR_MSG_WM_DISPLAYCHANGE(OnDisplayChange)
354 MSG_WM_ENTERMENULOOP(OnEnterMenuLoop) 353 CR_MSG_WM_ENTERMENULOOP(OnEnterMenuLoop)
355 MSG_WM_EXITMENULOOP(OnExitMenuLoop) 354 CR_MSG_WM_EXITMENULOOP(OnExitMenuLoop)
356 MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove) 355 CR_MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove)
357 MSG_WM_ERASEBKGND(OnEraseBkgnd) 356 CR_MSG_WM_ERASEBKGND(OnEraseBkgnd)
358 MSG_WM_EXITSIZEMOVE(OnExitSizeMove) 357 CR_MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
359 MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo) 358 CR_MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
360 MSG_WM_INITMENU(OnInitMenu) 359 CR_MSG_WM_INITMENU(OnInitMenu)
361 MSG_WM_INPUTLANGCHANGE(OnInputLangChange) 360 CR_MSG_WM_INPUTLANGCHANGE(OnInputLangChange)
362 MSG_WM_KILLFOCUS(OnKillFocus) 361 CR_MSG_WM_KILLFOCUS(OnKillFocus)
363 MSG_WM_MOVE(OnMove) 362 CR_MSG_WM_MOVE(OnMove)
364 MSG_WM_MOVING(OnMoving) 363 CR_MSG_WM_MOVING(OnMoving)
365 MSG_WM_NCCALCSIZE(OnNCCalcSize) 364 CR_MSG_WM_NCCALCSIZE(OnNCCalcSize)
366 MSG_WM_NCHITTEST(OnNCHitTest) 365 CR_MSG_WM_NCHITTEST(OnNCHitTest)
367 MSG_WM_NCPAINT(OnNCPaint) 366 CR_MSG_WM_NCPAINT(OnNCPaint)
368 MSG_WM_NOTIFY(OnNotify) 367 CR_MSG_WM_NOTIFY(OnNotify)
369 MSG_WM_PAINT(OnPaint) 368 CR_MSG_WM_PAINT(OnPaint)
370 MSG_WM_SETFOCUS(OnSetFocus) 369 CR_MSG_WM_SETFOCUS(OnSetFocus)
371 MSG_WM_SETICON(OnSetIcon) 370 CR_MSG_WM_SETICON(OnSetIcon)
372 MSG_WM_SETTEXT(OnSetText) 371 CR_MSG_WM_SETTEXT(OnSetText)
373 MSG_WM_SETTINGCHANGE(OnSettingChange) 372 CR_MSG_WM_SETTINGCHANGE(OnSettingChange)
374 MSG_WM_SIZE(OnSize) 373 CR_MSG_WM_SIZE(OnSize)
375 MSG_WM_SYSCOMMAND(OnSysCommand) 374 CR_MSG_WM_SYSCOMMAND(OnSysCommand)
376 MSG_WM_THEMECHANGED(OnThemeChanged) 375 CR_MSG_WM_THEMECHANGED(OnThemeChanged)
377 MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) 376 CR_MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged)
378 MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging) 377 CR_MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging)
379 MSG_WM_WTSSESSION_CHANGE(OnSessionChange) 378 CR_MSG_WM_WTSSESSION_CHANGE(OnSessionChange)
380 END_MSG_MAP() 379 CR_END_MSG_MAP()
381 380
382 // Message Handlers. 381 // Message Handlers.
383 // This list is in _ALPHABETICAL_ order! 382 // This list is in _ALPHABETICAL_ order!
384 // TODO(beng): Once this object becomes the WindowImpl, these methods can 383 // TODO(beng): Once this object becomes the WindowImpl, these methods can
385 // be made private. 384 // be made private.
386 void OnActivateApp(BOOL active, DWORD thread_id); 385 void OnActivateApp(BOOL active, DWORD thread_id);
387 // TODO(beng): return BOOL is temporary until this object becomes a 386 // TODO(beng): return BOOL is temporary until this object becomes a
388 // WindowImpl. 387 // WindowImpl.
389 BOOL OnAppCommand(HWND window, short command, WORD device, int keystate); 388 BOOL OnAppCommand(HWND window, short command, WORD device, int keystate);
390 void OnCancelMode(); 389 void OnCancelMode();
391 void OnCaptureChanged(HWND window); 390 void OnCaptureChanged(HWND window);
392 void OnClose(); 391 void OnClose();
393 void OnCommand(UINT notification_code, int command, HWND window); 392 void OnCommand(UINT notification_code, int command, HWND window);
394 LRESULT OnCreate(CREATESTRUCT* create_struct); 393 LRESULT OnCreate(CREATESTRUCT* create_struct);
395 void OnDestroy(); 394 void OnDestroy();
396 void OnDisplayChange(UINT bits_per_pixel, const CSize& screen_size); 395 void OnDisplayChange(UINT bits_per_pixel, const gfx::Size& screen_size);
397 LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, LPARAM l_param); 396 LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, LPARAM l_param);
398 void OnEnterMenuLoop(BOOL from_track_popup_menu); 397 void OnEnterMenuLoop(BOOL from_track_popup_menu);
399 void OnEnterSizeMove(); 398 void OnEnterSizeMove();
400 LRESULT OnEraseBkgnd(HDC dc); 399 LRESULT OnEraseBkgnd(HDC dc);
401 void OnExitMenuLoop(BOOL is_shortcut_menu); 400 void OnExitMenuLoop(BOOL is_shortcut_menu);
402 void OnExitSizeMove(); 401 void OnExitSizeMove();
403 void OnGetMinMaxInfo(MINMAXINFO* minmax_info); 402 void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
404 LRESULT OnGetObject(UINT message, WPARAM w_param, LPARAM l_param); 403 LRESULT OnGetObject(UINT message, WPARAM w_param, LPARAM l_param);
405 LRESULT OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param); 404 LRESULT OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param);
406 void OnInitMenu(HMENU menu); 405 void OnInitMenu(HMENU menu);
407 void OnInputLangChange(DWORD character_set, HKL input_language_id); 406 void OnInputLangChange(DWORD character_set, HKL input_language_id);
408 LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param); 407 LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param);
409 void OnKillFocus(HWND focused_window); 408 void OnKillFocus(HWND focused_window);
410 LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param); 409 LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param);
411 LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param); 410 LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
412 void OnMove(const CPoint& point); 411 void OnMove(const gfx::Point& point);
413 void OnMoving(UINT param, const RECT* new_bounds); 412 void OnMoving(UINT param, const RECT* new_bounds);
414 LRESULT OnNCActivate(UINT message, WPARAM w_param, LPARAM l_param); 413 LRESULT OnNCActivate(UINT message, WPARAM w_param, LPARAM l_param);
415 LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); 414 LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param);
416 LRESULT OnNCHitTest(const CPoint& point); 415 LRESULT OnNCHitTest(const gfx::Point& point);
417 void OnNCPaint(HRGN rgn); 416 void OnNCPaint(HRGN rgn);
418 LRESULT OnNCUAHDrawCaption(UINT message, WPARAM w_param, LPARAM l_param); 417 LRESULT OnNCUAHDrawCaption(UINT message, WPARAM w_param, LPARAM l_param);
419 LRESULT OnNCUAHDrawFrame(UINT message, WPARAM w_param, LPARAM l_param); 418 LRESULT OnNCUAHDrawFrame(UINT message, WPARAM w_param, LPARAM l_param);
420 LRESULT OnNotify(int w_param, NMHDR* l_param); 419 LRESULT OnNotify(int w_param, NMHDR* l_param);
421 void OnPaint(HDC dc); 420 void OnPaint(HDC dc);
422 LRESULT OnReflectedMessage(UINT message, WPARAM w_param, LPARAM l_param); 421 LRESULT OnReflectedMessage(UINT message, WPARAM w_param, LPARAM l_param);
423 LRESULT OnScrollMessage(UINT message, WPARAM w_param, LPARAM l_param); 422 LRESULT OnScrollMessage(UINT message, WPARAM w_param, LPARAM l_param);
424 void OnSessionChange(WPARAM status_code, PWTSSESSION_NOTIFICATION session_id); 423 void OnSessionChange(WPARAM status_code, PWTSSESSION_NOTIFICATION session_id);
425 LRESULT OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param); 424 LRESULT OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param);
426 void OnSetFocus(HWND last_focused_window); 425 void OnSetFocus(HWND last_focused_window);
427 LRESULT OnSetIcon(UINT size_type, HICON new_icon); 426 LRESULT OnSetIcon(UINT size_type, HICON new_icon);
428 LRESULT OnSetText(const wchar_t* text); 427 LRESULT OnSetText(const wchar_t* text);
429 void OnSettingChange(UINT flags, const wchar_t* section); 428 void OnSettingChange(UINT flags, const wchar_t* section);
430 void OnSize(UINT param, const CSize& size); 429 void OnSize(UINT param, const gfx::Size& size);
431 void OnSysCommand(UINT notification_code, const CPoint& point); 430 void OnSysCommand(UINT notification_code, const gfx::Point& point);
432 void OnThemeChanged(); 431 void OnThemeChanged();
433 LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param); 432 LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param);
434 void OnWindowPosChanging(WINDOWPOS* window_pos); 433 void OnWindowPosChanging(WINDOWPOS* window_pos);
435 void OnWindowPosChanged(WINDOWPOS* window_pos); 434 void OnWindowPosChanged(WINDOWPOS* window_pos);
436 435
437 typedef std::vector<ui::TouchEvent> TouchEvents; 436 typedef std::vector<ui::TouchEvent> TouchEvents;
438 // Helper to handle the list of touch events passed in. We need this because 437 // Helper to handle the list of touch events passed in. We need this because
439 // touch events on windows don't fire if we enter a modal loop in the context 438 // touch events on windows don't fire if we enter a modal loop in the context
440 // of a touch event. 439 // of a touch event.
441 void HandleTouchEvents(const TouchEvents& touch_events); 440 void HandleTouchEvents(const TouchEvents& touch_events);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 }; 555 };
557 556
558 // This window property if set on the window does not activate the window for a 557 // This window property if set on the window does not activate the window for a
559 // touch based WM_MOUSEACTIVATE message. 558 // touch based WM_MOUSEACTIVATE message.
560 const wchar_t kIgnoreTouchMouseActivateForWindow[] = 559 const wchar_t kIgnoreTouchMouseActivateForWindow[] =
561 L"Chrome.IgnoreMouseActivate"; 560 L"Chrome.IgnoreMouseActivate";
562 561
563 } // namespace views 562 } // namespace views
564 563
565 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 564 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « ui/gfx/win/window_impl.h ('k') | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698