OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/widget_win.h" | 5 #include "chrome/views/widget_win.h" |
6 | 6 |
7 #include "base/gfx/native_theme.h" | 7 #include "base/gfx/native_theme.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // will fail. | 155 // will fail. |
156 if (parent && !::IsWindow(parent)) { | 156 if (parent && !::IsWindow(parent)) { |
157 NOTREACHED() << "invalid parent window specified."; | 157 NOTREACHED() << "invalid parent window specified."; |
158 parent = NULL; | 158 parent = NULL; |
159 } | 159 } |
160 | 160 |
161 hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"", | 161 hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"", |
162 window_style_, bounds.x(), bounds.y(), bounds.width(), | 162 window_style_, bounds.x(), bounds.y(), bounds.width(), |
163 bounds.height(), parent, NULL, NULL, this); | 163 bounds.height(), parent, NULL, NULL, this); |
164 DCHECK(hwnd_); | 164 DCHECK(hwnd_); |
165 TRACK_HWND_CREATION(hwnd_); | |
166 | |
167 // The window procedure should have set the data for us. | 165 // The window procedure should have set the data for us. |
168 DCHECK(win_util::GetWindowUserData(hwnd_) == this); | 166 DCHECK(win_util::GetWindowUserData(hwnd_) == this); |
169 | 167 |
170 root_view_->OnWidgetCreated(); | 168 root_view_->OnWidgetCreated(); |
171 | 169 |
172 if (has_own_focus_manager) { | 170 if (has_own_focus_manager) { |
173 FocusManager::CreateFocusManager(hwnd_, GetRootView()); | 171 FocusManager::CreateFocusManager(hwnd_, GetRootView()); |
174 } else { | 172 } else { |
175 // Subclass the window so we get the tab key messages when a view with no | 173 // Subclass the window so we get the tab key messages when a view with no |
176 // associated native window is focused. | 174 // associated native window is focused. |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 return TRUE; | 925 return TRUE; |
928 } | 926 } |
929 WidgetWin* widget = reinterpret_cast<WidgetWin*>( | 927 WidgetWin* widget = reinterpret_cast<WidgetWin*>( |
930 win_util::GetWindowUserData(window)); | 928 win_util::GetWindowUserData(window)); |
931 if (!widget) | 929 if (!widget) |
932 return 0; | 930 return 0; |
933 LRESULT result = 0; | 931 LRESULT result = 0; |
934 if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result)) | 932 if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result)) |
935 result = DefWindowProc(window, message, w_param, l_param); | 933 result = DefWindowProc(window, message, w_param, l_param); |
936 if (message == WM_NCDESTROY) { | 934 if (message == WM_NCDESTROY) { |
937 TRACK_HWND_DESTRUCTION(window); | |
938 widget->hwnd_ = NULL; | 935 widget->hwnd_ = NULL; |
939 widget->OnFinalMessage(window); | 936 widget->OnFinalMessage(window); |
940 } | 937 } |
941 return result; | 938 return result; |
942 } | 939 } |
943 | 940 |
944 } // namespace views | 941 } // namespace views |
945 | 942 |
OLD | NEW |