Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: chrome/views/widget_win.cc

Issue 21018: Adding tracking of HWND creation/destruction (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
165 // The window procedure should have set the data for us. 167 // The window procedure should have set the data for us.
166 DCHECK(win_util::GetWindowUserData(hwnd_) == this); 168 DCHECK(win_util::GetWindowUserData(hwnd_) == this);
167 169
168 root_view_->OnWidgetCreated(); 170 root_view_->OnWidgetCreated();
169 171
170 if (has_own_focus_manager) { 172 if (has_own_focus_manager) {
171 FocusManager::CreateFocusManager(hwnd_, GetRootView()); 173 FocusManager::CreateFocusManager(hwnd_, GetRootView());
172 } else { 174 } else {
173 // Subclass the window so we get the tab key messages when a view with no 175 // Subclass the window so we get the tab key messages when a view with no
174 // associated native window is focused. 176 // associated native window is focused.
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 return TRUE; 927 return TRUE;
926 } 928 }
927 WidgetWin* widget = reinterpret_cast<WidgetWin*>( 929 WidgetWin* widget = reinterpret_cast<WidgetWin*>(
928 win_util::GetWindowUserData(window)); 930 win_util::GetWindowUserData(window));
929 if (!widget) 931 if (!widget)
930 return 0; 932 return 0;
931 LRESULT result = 0; 933 LRESULT result = 0;
932 if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result)) 934 if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result))
933 result = DefWindowProc(window, message, w_param, l_param); 935 result = DefWindowProc(window, message, w_param, l_param);
934 if (message == WM_NCDESTROY) { 936 if (message == WM_NCDESTROY) {
937 TRACK_HWND_DESTRUCTION(window);
935 widget->hwnd_ = NULL; 938 widget->hwnd_ = NULL;
936 widget->OnFinalMessage(window); 939 widget->OnFinalMessage(window);
937 } 940 }
938 return result; 941 return result;
939 } 942 }
940 943
941 } // namespace views 944 } // namespace views
942 945
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698