summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 05:25:35 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 05:25:35 +0000
commit891f4c8e2c3d2d8d5ca2d3f325bd4d65addc2a26 (patch)
tree34ebb8b9c8b60fc449e1d6f56af77984d11aef47 /views
parentef182dbe40064d00f2695ab1dd9c7509d253012d (diff)
downloadchromium_src-891f4c8e2c3d2d8d5ca2d3f325bd4d65addc2a26.zip
chromium_src-891f4c8e2c3d2d8d5ca2d3f325bd4d65addc2a26.tar.gz
chromium_src-891f4c8e2c3d2d8d5ca2d3f325bd4d65addc2a26.tar.bz2
Reverting 31646.
Review URL: http://codereview.chromium.org/386006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/widget_gtk.cc10
-rw-r--r--views/widget/widget_win.cc19
2 files changed, 13 insertions, 16 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 64a9063..8762e14 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -106,10 +106,9 @@ WidgetGtk::WidgetGtk(Type type)
}
WidgetGtk::~WidgetGtk() {
- // If we're deleted directly, instead of via OnDestroy(), then clean up after
- // ourselves.
- delete_on_destroy_ = false; // Prevent double free.
- CloseNow();
+ if (type_ != TYPE_CHILD)
+ ActiveWindowWatcherX::RemoveObserver(this);
+ MessageLoopForUI::current()->RemoveObserver(this);
}
GtkWindow* WidgetGtk::GetTransientParent() const {
@@ -819,9 +818,6 @@ void WidgetGtk::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) {
void WidgetGtk::OnDestroy() {
widget_ = window_contents_ = NULL;
- if (type_ != TYPE_CHILD)
- ActiveWindowWatcherX::RemoveObserver(this);
- MessageLoopForUI::current()->RemoveObserver(this);
if (delete_on_destroy_) {
// Delays the deletion of this WidgetGtk as we want its children to have
// access to it when destroyed.
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 2c07c3d..79956a8 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -58,10 +58,7 @@ WidgetWin::WidgetWin()
}
WidgetWin::~WidgetWin() {
- // If we're deleted directly, instead of via a WM_NCDESTROY, then clean up
- // after ourselves.
- delete_on_destroy_ = false; // Prevent double free.
- CloseNow();
+ MessageLoopForUI::current()->RemoveObserver(this);
}
// static
@@ -118,12 +115,17 @@ void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
// Windows special DWM window frame requires a special tooltip manager so
// that window controls in Chrome windows don't flicker when you move your
// mouse over them. See comment in aero_tooltip_manager.h.
- tooltip_manager_.reset(GetThemeProvider()->ShouldUseNativeFrame() ?
- new AeroTooltipManager(this) : new TooltipManagerWin(this));
+ if (GetThemeProvider()->ShouldUseNativeFrame()) {
+ tooltip_manager_.reset(new AeroTooltipManager(this));
+ } else {
+ tooltip_manager_.reset(new TooltipManagerWin(this));
+ }
// This message initializes the window so that focus border are shown for
// windows.
- SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
+ SendMessage(hwnd(),
+ WM_CHANGEUISTATE,
+ MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
0);
// Bug 964884: detach the IME attached to this window.
@@ -825,7 +827,6 @@ void WidgetWin::OnThemeChanged() {
}
void WidgetWin::OnFinalMessage(HWND window) {
- MessageLoopForUI::current()->RemoveObserver(this);
if (delete_on_destroy_)
delete this;
}
@@ -1119,7 +1120,7 @@ LRESULT WidgetWin::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
if (!ProcessWindowMessage(window, message, w_param, l_param, result))
result = DefWindowProc(window, message, w_param, l_param);
if (message == WM_NCDESTROY)
- OnFinalMessage(window); // CAUTION: May reset members and/or delete |this|!
+ OnFinalMessage(window);
if (message == WM_ACTIVATE)
PostProcessActivateMessage(this, LOWORD(w_param));
if (message == WM_ENABLE && restore_focus_when_enabled_) {