OLD | NEW |
1 // Copyright (c) 2011 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 "ui/base/win/window_impl.h" | 5 #include "ui/base/win/window_impl.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 return window->OnWndProc(message, w_param, l_param); | 191 return window->OnWndProc(message, w_param, l_param); |
192 } | 192 } |
193 | 193 |
194 std::wstring WindowImpl::GetWindowClassName() { | 194 std::wstring WindowImpl::GetWindowClassName() { |
195 ClassInfo class_info(initial_class_style()); | 195 ClassInfo class_info(initial_class_style()); |
196 std::wstring name; | 196 std::wstring name; |
197 if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name)) | 197 if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name)) |
198 return name; | 198 return name; |
199 | 199 |
| 200 HICON icon = GetDefaultWindowIcon(); |
| 201 |
200 // No class found, need to register one. | 202 // No class found, need to register one. |
201 WNDCLASSEX class_ex; | 203 WNDCLASSEX class_ex = { |
202 class_ex.cbSize = sizeof(WNDCLASSEX); | 204 sizeof(WNDCLASSEX), |
203 class_ex.style = class_info.style; | 205 class_info.style, |
204 class_ex.lpfnWndProc = base::win::WrappedWindowProc<&WindowImpl::WndProc>; | 206 base::win::WrappedWindowProc<&WindowImpl::WndProc>, |
205 class_ex.cbClsExtra = 0; | 207 0, |
206 class_ex.cbWndExtra = 0; | 208 0, |
207 class_ex.hInstance = NULL; | 209 NULL, |
208 class_ex.hIcon = GetDefaultWindowIcon(); | 210 icon, |
209 class_ex.hCursor = LoadCursor(NULL, IDC_ARROW); | 211 NULL, |
210 class_ex.hbrBackground = reinterpret_cast<HBRUSH>(class_info.background + 1); | 212 reinterpret_cast<HBRUSH>(class_info.background + 1), |
211 class_ex.lpszMenuName = NULL; | 213 NULL, |
212 class_ex.lpszClassName = name.c_str(); | 214 name.c_str(), |
213 class_ex.hIconSm = class_ex.hIcon; | 215 icon |
| 216 }; |
214 ATOM atom = RegisterClassEx(&class_ex); | 217 ATOM atom = RegisterClassEx(&class_ex); |
215 CHECK(atom) << GetLastError(); | 218 CHECK(atom) << GetLastError(); |
216 | 219 |
217 ClassRegistrar::GetInstance()->RegisterClass(class_info, name, atom); | 220 ClassRegistrar::GetInstance()->RegisterClass(class_info, name, atom); |
218 | 221 |
219 return name; | 222 return name; |
220 } | 223 } |
221 | 224 |
222 } // namespace ui | 225 } // namespace ui |
OLD | NEW |