OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/window_impl.h" | 5 #include "gfx/window_impl.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
| 9 #include "base/logging.h" |
9 #include "base/singleton.h" | 10 #include "base/singleton.h" |
10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
11 #include "base/win_util.h" | 12 #include "base/win_util.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
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; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 DCHECK(hwnd_); | 146 DCHECK(hwnd_); |
146 | 147 |
147 // The window procedure should have set the data for us. | 148 // The window procedure should have set the data for us. |
148 DCHECK(win_util::GetWindowUserData(hwnd_) == this); | 149 DCHECK(win_util::GetWindowUserData(hwnd_) == this); |
149 } | 150 } |
150 | 151 |
151 HICON WindowImpl::GetDefaultWindowIcon() const { | 152 HICON WindowImpl::GetDefaultWindowIcon() const { |
152 return NULL; | 153 return NULL; |
153 } | 154 } |
154 | 155 |
| 156 void WindowImpl::set_initial_class_style(UINT class_style) { |
| 157 // We dynamically generate the class name, so don't register it globally! |
| 158 DCHECK_EQ((class_style & CS_GLOBALCLASS), 0u); |
| 159 class_style_ = class_style; |
| 160 } |
| 161 |
155 // static | 162 // static |
156 bool WindowImpl::IsWindowImpl(HWND hwnd) { | 163 bool WindowImpl::IsWindowImpl(HWND hwnd) { |
157 wchar_t tmp[128]; | 164 wchar_t tmp[128]; |
158 if (!::GetClassName(hwnd, tmp, 128)) | 165 if (!::GetClassName(hwnd, tmp, 128)) |
159 return false; | 166 return false; |
160 | 167 |
161 std::wstring class_name(tmp); | 168 std::wstring class_name(tmp); |
162 return class_name.find(kBaseClassName) == 0; | 169 return class_name.find(kBaseClassName) == 0; |
163 } | 170 } |
164 | 171 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 class_ex.hIconSm = class_ex.hIcon; | 224 class_ex.hIconSm = class_ex.hIcon; |
218 ATOM atom = RegisterClassEx(&class_ex); | 225 ATOM atom = RegisterClassEx(&class_ex); |
219 DCHECK(atom); | 226 DCHECK(atom); |
220 | 227 |
221 Singleton<ClassRegistrar>()->RegisterClass(class_info, name, atom); | 228 Singleton<ClassRegistrar>()->RegisterClass(class_info, name, atom); |
222 | 229 |
223 return name; | 230 return name; |
224 } | 231 } |
225 | 232 |
226 } // namespace gfx | 233 } // namespace gfx |
OLD | NEW |