diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 19:06:33 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 19:06:33 +0000 |
commit | a62d09f5aa351a2d395a1ba74c53ae29bee712e8 (patch) | |
tree | 6b3a17895aa054067e559fb370e97aed2479ccca /views | |
parent | 24f49bd3da572b7c94a5b66b60e49a0685a9912c (diff) | |
download | chromium_src-a62d09f5aa351a2d395a1ba74c53ae29bee712e8.zip chromium_src-a62d09f5aa351a2d395a1ba74c53ae29bee712e8.tar.gz chromium_src-a62d09f5aa351a2d395a1ba74c53ae29bee712e8.tar.bz2 |
Centralizes checking for non-null return from CreateWindow.
BUG=none
TEST=none
R=ben@chromium.org
Review URL: http://codereview.chromium.org/6880034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82137 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/native_button_win.cc | 4 | ||||
-rw-r--r-- | views/controls/combobox/native_combobox_win.cc | 4 | ||||
-rw-r--r-- | views/controls/listbox/native_listbox_win.cc | 4 | ||||
-rw-r--r-- | views/controls/menu/native_menu_win.cc | 1 | ||||
-rw-r--r-- | views/controls/scrollbar/native_scroll_bar_win.cc | 4 | ||||
-rw-r--r-- | views/controls/separator.cc | 7 | ||||
-rw-r--r-- | views/controls/tabbed_pane/native_tabbed_pane_win.cc | 2 | ||||
-rw-r--r-- | views/controls/table/native_table_win.cc | 3 | ||||
-rw-r--r-- | views/controls/table/table_view.cc | 3 | ||||
-rw-r--r-- | views/controls/tree/tree_view.cc | 3 | ||||
-rw-r--r-- | views/widget/aero_tooltip_manager.cc | 2 | ||||
-rw-r--r-- | views/widget/tooltip_manager_win.cc | 4 |
12 files changed, 33 insertions, 8 deletions
diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc index 60a6c40..66a96d9 100644 --- a/views/controls/button/native_button_win.cc +++ b/views/controls/button/native_button_win.cc @@ -12,6 +12,7 @@ #include "base/win/win_util.h" #include "base/win/windows_version.h" #include "ui/base/accessibility/accessible_view_state.h" +#include "ui/base/win/hwnd_util.h" #include "views/controls/button/checkbox.h" #include "views/controls/button/native_button.h" #include "views/controls/button/radio_button.h" @@ -150,6 +151,7 @@ void NativeButtonWin::CreateNativeControl() { flags, 0, 0, width(), height(), GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(control_hwnd); NativeControlCreated(control_hwnd); } @@ -228,6 +230,7 @@ void NativeCheckboxWin::CreateNativeControl() { GetAdditionalExStyle(), L"BUTTON", L"", WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | BS_CHECKBOX, 0, 0, width(), height(), GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(control_hwnd); NativeControlCreated(control_hwnd); } @@ -254,6 +257,7 @@ void NativeRadioButtonWin::CreateNativeControl() { GetAdditionalExStyle(), L"BUTTON", L"", WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | BS_RADIOBUTTON, 0, 0, width(), height(), GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(control_hwnd); NativeControlCreated(control_hwnd); } diff --git a/views/controls/combobox/native_combobox_win.cc b/views/controls/combobox/native_combobox_win.cc index 7190440..dc5ef09 100644 --- a/views/controls/combobox/native_combobox_win.cc +++ b/views/controls/combobox/native_combobox_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "base/utf_string_conversions.h" #include "ui/base/models/combobox_model.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/win/hwnd_util.h" #include "ui/gfx/font.h" #include "ui/gfx/native_theme_win.h" #include "views/controls/combobox/combobox.h" @@ -167,6 +168,7 @@ void NativeComboboxWin::CreateNativeControl() { flags, 0, 0, width(), height(), GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(control_hwnd); NativeControlCreated(control_hwnd); } diff --git a/views/controls/listbox/native_listbox_win.cc b/views/controls/listbox/native_listbox_win.cc index 8e31ad7..762555b 100644 --- a/views/controls/listbox/native_listbox_win.cc +++ b/views/controls/listbox/native_listbox_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include "base/utf_string_conversions.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/win/hwnd_util.h" #include "ui/gfx/font.h" #include "views/controls/listbox/listbox.h" #include "views/widget/widget.h" @@ -103,6 +104,7 @@ void NativeListboxWin::CreateNativeControl() { 0, 0, width(), height(), listbox_->GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(hwnd); HFONT font = ResourceBundle::GetSharedInstance(). GetFont(ResourceBundle::BaseFont).GetNativeFont(); SendMessage(hwnd, WM_SETFONT, reinterpret_cast<WPARAM>(font), FALSE); diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index 9d7369b..4a505a3 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -70,6 +70,7 @@ class NativeMenuWin::MenuHostWindow { RegisterClass(); hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName, L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); + ui::CheckWindowCreated(hwnd_); ui::SetWindowUserData(hwnd_, this); } diff --git a/views/controls/scrollbar/native_scroll_bar_win.cc b/views/controls/scrollbar/native_scroll_bar_win.cc index 01cd5f8..7c1b5d7 100644 --- a/views/controls/scrollbar/native_scroll_bar_win.cc +++ b/views/controls/scrollbar/native_scroll_bar_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include "base/message_loop.h" #include "ui/base/keycodes/keyboard_codes.h" +#include "ui/base/win/hwnd_util.h" #include "ui/base/win/window_impl.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/controls/scrollbar/scroll_bar.h" @@ -79,6 +80,7 @@ class ScrollBarContainer : public ui::WindowImpl { SBS_HORZ : SBS_VERT), 0, 0, parent_->width(), parent_->height(), hwnd(), NULL, NULL, NULL); + ui::CheckWindowCreated(scrollbar_); ShowWindow(scrollbar_, SW_SHOW); return 1; } diff --git a/views/controls/separator.cc b/views/controls/separator.cc index bc1f522..f7ec9ff 100644 --- a/views/controls/separator.cc +++ b/views/controls/separator.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,12 +6,14 @@ #include "base/logging.h" #include "ui/base/accessibility/accessible_view_state.h" +#include "views/widget/widget.h" + #if defined(OS_LINUX) #include "views/controls/native_control_gtk.h" #elif defined(OS_WIN) +#include "ui/base/win/hwnd_util.h" #include "views/controls/native_control_win.h" #endif -#include "views/widget/widget.h" namespace views { @@ -28,6 +30,7 @@ class NativeSeparatorWin : public NativeControlWin { 0, 0, width(), height(), separator_->GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(control_hwnd); NativeControlCreated(control_hwnd); } diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc index 1b488528..91e053f 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc @@ -10,6 +10,7 @@ #include "base/stl_util-inl.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/win/hwnd_util.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/font.h" #include "ui/gfx/native_theme_win.h" @@ -283,6 +284,7 @@ void NativeTabbedPaneWin::CreateNativeControl() { 0, 0, width(), height(), GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(tab_control); HFONT font = ResourceBundle::GetSharedInstance(). GetFont(ResourceBundle::BaseFont).GetNativeFont(); diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc index aba9027..4d5f69f 100644 --- a/views/controls/table/native_table_win.cc +++ b/views/controls/table/native_table_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -367,6 +367,7 @@ void NativeTableWin::CreateNativeControl() { 0, 0, width(), height(), table_->GetWidget()->GetNativeView(), NULL, NULL, NULL); + ui::CheckWindowCreated(hwnd); // Reduce overdraw/flicker artifacts by double buffering. Support tooltips // and display elided items completely on hover (see comments in OnNotify() diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index fa2817f..4a3b1cb6 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -776,6 +776,7 @@ HWND TableView::CreateNativeControl(HWND parent_container) { style, 0, 0, width(), height(), parent_container, NULL, NULL, NULL); + ui::CheckWindowCreated(list_view_); // Reduce overdraw/flicker artifacts by double buffering. Support tooltips // and display elided items completely on hover (see comments in OnNotify() diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 7afb8cb..db75226 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -331,6 +331,7 @@ HWND TreeView::CreateNativeControl(HWND parent_container) { style, 0, 0, width(), height(), parent_container, NULL, NULL, NULL); + ui::CheckWindowCreated(tree_view_); SetWindowLongPtr(tree_view_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(&wrapper_)); original_handler_ = ui::SetWindowProc(tree_view_, &TreeWndProc); diff --git a/views/widget/aero_tooltip_manager.cc b/views/widget/aero_tooltip_manager.cc index 8cc6821..855271e 100644 --- a/views/widget/aero_tooltip_manager.cc +++ b/views/widget/aero_tooltip_manager.cc @@ -10,6 +10,7 @@ #include "base/message_loop.h" #include "ui/base/l10n/l10n_util_win.h" +#include "ui/base/win/hwnd_util.h" #include "ui/gfx/point.h" namespace views { @@ -77,6 +78,7 @@ void AeroTooltipManager::Init() { WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, GetParent(), NULL, NULL, NULL); + ui::CheckWindowCreated(tooltip_hwnd_); l10n_util::AdjustUIFontForWindow(tooltip_hwnd_); diff --git a/views/widget/tooltip_manager_win.cc b/views/widget/tooltip_manager_win.cc index 2d89a4a..e905218 100644 --- a/views/widget/tooltip_manager_win.cc +++ b/views/widget/tooltip_manager_win.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "ui/base/l10n/l10n_util_win.h" +#include "ui/base/win/hwnd_util.h" #include "ui/gfx/font.h" #include "views/screen.h" #include "views/view.h" @@ -36,6 +37,7 @@ static gfx::Font DetermineDefaultFont() { HWND window = CreateWindowEx( WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), TOOLTIPS_CLASS, NULL, 0 , 0, 0, 0, 0, NULL, NULL, NULL, NULL); + ui::CheckWindowCreated(window); HFONT hfont = reinterpret_cast<HFONT>(SendMessage(window, WM_GETFONT, 0, 0)); gfx::Font font = hfont ? gfx::Font(hfont) : gfx::Font(); DestroyWindow(window); @@ -95,6 +97,7 @@ void TooltipManagerWin::Init() { WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, GetParent(), NULL, NULL, NULL); + ui::CheckWindowCreated(tooltip_hwnd_); l10n_util::AdjustUIFontForWindow(tooltip_hwnd_); @@ -333,6 +336,7 @@ void TooltipManagerWin::ShowKeyboardTooltip(View* focused_view) { keyboard_tooltip_hwnd_ = CreateWindowEx( WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); + ui::CheckWindowCreated(keyboard_tooltip_hwnd_); SendMessage(keyboard_tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0, std::numeric_limits<short>::max()); int tooltip_width; |