summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--app/win/window_impl.cc14
-rw-r--r--app/win/window_impl.h4
-rw-r--r--views/widget/widget_gtk.cc10
-rw-r--r--views/widget/widget_win.cc19
4 files changed, 14 insertions, 33 deletions
diff --git a/app/win/window_impl.cc b/app/win/window_impl.cc
index 8ddd2bc..b28eab5 100644
--- a/app/win/window_impl.cc
+++ b/app/win/window_impl.cc
@@ -180,15 +180,7 @@ LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd,
if (!window)
return 0;
- LRESULT return_code = window->OnWndProc(message, w_param, l_param);
-
- // Clean up state. Do this after the above call so subclasses still have a
- // valid hwnd(). Can't wait until WM_NCDESTROY because by then |hwnd| is not
- // guaranteed to be reported to us.
- if (message == WM_DESTROY)
- window->OnDestroy();
-
- return return_code;
+ return window->OnWndProc(message, w_param, l_param);
}
std::wstring WindowImpl::GetWindowClassName() {
@@ -219,8 +211,4 @@ std::wstring WindowImpl::GetWindowClassName() {
return name;
}
-void WindowImpl::OnDestroy() {
- hwnd_ = 0;
-}
-
} // namespace app
diff --git a/app/win/window_impl.h b/app/win/window_impl.h
index dd7ef5a..fb5d512 100644
--- a/app/win/window_impl.h
+++ b/app/win/window_impl.h
@@ -87,10 +87,6 @@ class WindowImpl : public MessageMapInterface {
// If necessary, this registers the window class.
std::wstring GetWindowClassName();
- // Called when the HWND gets a WM_DESTROY message; should cause us to clean
- // up any state.
- void OnDestroy();
-
// All classes registered by WidgetWin start with this name.
static const wchar_t* const kBaseClassName;
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_) {