| 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 "ui/base/win/hwnd_util.h" | |
| 10 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 11 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/win/wrapped_window_proc.h" |
| 12 #include "ui/base/win/hwnd_util.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 static const DWORD kWindowDefaultChildStyle = | 16 static const DWORD kWindowDefaultChildStyle = |
| 16 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; | 17 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
| 17 static const DWORD kWindowDefaultStyle = WS_OVERLAPPEDWINDOW; | 18 static const DWORD kWindowDefaultStyle = WS_OVERLAPPEDWINDOW; |
| 18 static const DWORD kWindowDefaultExStyle = 0; | 19 static const DWORD kWindowDefaultExStyle = 0; |
| 19 | 20 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 21 /////////////////////////////////////////////////////////////////////////////// |
| 21 // WindowImpl class tracking. | 22 // WindowImpl class tracking. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 std::wstring WindowImpl::GetWindowClassName() { | 203 std::wstring WindowImpl::GetWindowClassName() { |
| 203 ClassInfo class_info(initial_class_style()); | 204 ClassInfo class_info(initial_class_style()); |
| 204 std::wstring name; | 205 std::wstring name; |
| 205 if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name)) | 206 if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name)) |
| 206 return name; | 207 return name; |
| 207 | 208 |
| 208 // No class found, need to register one. | 209 // No class found, need to register one. |
| 209 WNDCLASSEX class_ex; | 210 WNDCLASSEX class_ex; |
| 210 class_ex.cbSize = sizeof(WNDCLASSEX); | 211 class_ex.cbSize = sizeof(WNDCLASSEX); |
| 211 class_ex.style = class_info.style; | 212 class_ex.style = class_info.style; |
| 212 class_ex.lpfnWndProc = &WindowImpl::WndProc; | 213 class_ex.lpfnWndProc = base::win::WrappedWindowProc<&WindowImpl::WndProc>; |
| 213 class_ex.cbClsExtra = 0; | 214 class_ex.cbClsExtra = 0; |
| 214 class_ex.cbWndExtra = 0; | 215 class_ex.cbWndExtra = 0; |
| 215 class_ex.hInstance = NULL; | 216 class_ex.hInstance = NULL; |
| 216 class_ex.hIcon = GetDefaultWindowIcon(); | 217 class_ex.hIcon = GetDefaultWindowIcon(); |
| 217 class_ex.hCursor = LoadCursor(NULL, IDC_ARROW); | 218 class_ex.hCursor = LoadCursor(NULL, IDC_ARROW); |
| 218 class_ex.hbrBackground = reinterpret_cast<HBRUSH>(class_info.background + 1); | 219 class_ex.hbrBackground = reinterpret_cast<HBRUSH>(class_info.background + 1); |
| 219 class_ex.lpszMenuName = NULL; | 220 class_ex.lpszMenuName = NULL; |
| 220 class_ex.lpszClassName = name.c_str(); | 221 class_ex.lpszClassName = name.c_str(); |
| 221 class_ex.hIconSm = class_ex.hIcon; | 222 class_ex.hIconSm = class_ex.hIcon; |
| 222 ATOM atom = RegisterClassEx(&class_ex); | 223 ATOM atom = RegisterClassEx(&class_ex); |
| 223 DCHECK(atom); | 224 DCHECK(atom); |
| 224 | 225 |
| 225 ClassRegistrar::GetInstance()->RegisterClass(class_info, name, atom); | 226 ClassRegistrar::GetInstance()->RegisterClass(class_info, name, atom); |
| 226 | 227 |
| 227 return name; | 228 return name; |
| 228 } | 229 } |
| 229 | 230 |
| 230 } // namespace ui | 231 } // namespace ui |
| OLD | NEW |