OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/menu/native_menu_win.h" | 5 #include "views/controls/menu/native_menu_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/win/wrapped_window_proc.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 11 #include "ui/base/keycodes/keyboard_codes.h" |
11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
12 #include "ui/base/l10n/l10n_util_win.h" | 13 #include "ui/base/l10n/l10n_util_win.h" |
13 #include "ui/base/win/hwnd_util.h" | 14 #include "ui/base/win/hwnd_util.h" |
14 #include "ui/gfx/canvas_skia.h" | 15 #include "ui/gfx/canvas_skia.h" |
15 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
16 #include "views/accelerator.h" | 17 #include "views/accelerator.h" |
17 #include "views/controls/menu/menu_2.h" | 18 #include "views/controls/menu/menu_2.h" |
18 | 19 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 static const wchar_t* kWindowClassName; | 70 static const wchar_t* kWindowClassName; |
70 | 71 |
71 void RegisterClass() { | 72 void RegisterClass() { |
72 static bool registered = false; | 73 static bool registered = false; |
73 if (registered) | 74 if (registered) |
74 return; | 75 return; |
75 | 76 |
76 WNDCLASSEX wcex = {0}; | 77 WNDCLASSEX wcex = {0}; |
77 wcex.cbSize = sizeof(WNDCLASSEX); | 78 wcex.cbSize = sizeof(WNDCLASSEX); |
78 wcex.style = CS_DBLCLKS; | 79 wcex.style = CS_DBLCLKS; |
79 wcex.lpfnWndProc = &MenuHostWindowProc; | 80 wcex.lpfnWndProc = base::win::WrappedWindowProc<&MenuHostWindowProc>; |
80 wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); | 81 wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); |
81 wcex.lpszClassName = kWindowClassName; | 82 wcex.lpszClassName = kWindowClassName; |
82 ATOM clazz = RegisterClassEx(&wcex); | 83 ATOM clazz = RegisterClassEx(&wcex); |
83 DCHECK(clazz); | 84 DCHECK(clazz); |
84 registered = true; | 85 registered = true; |
85 } | 86 } |
86 | 87 |
87 NativeMenuWin* GetNativeMenuWinFromHMENU(HMENU hmenu) const { | 88 NativeMenuWin* GetNativeMenuWinFromHMENU(HMENU hmenu) const { |
88 MENUINFO mi = {0}; | 89 MENUINFO mi = {0}; |
89 mi.cbSize = sizeof(mi); | 90 mi.cbSize = sizeof(mi); |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 631 |
631 //////////////////////////////////////////////////////////////////////////////// | 632 //////////////////////////////////////////////////////////////////////////////// |
632 // MenuWrapper, public: | 633 // MenuWrapper, public: |
633 | 634 |
634 // static | 635 // static |
635 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 636 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
636 return new NativeMenuWin(menu->model(), NULL); | 637 return new NativeMenuWin(menu->model(), NULL); |
637 } | 638 } |
638 | 639 |
639 } // namespace views | 640 } // namespace views |
OLD | NEW |