summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 03:00:30 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 03:00:30 +0000
commit672eca0fd191acd39c28430d1ed1f327594faff8 (patch)
tree56d0070a11a25756240d0a3088458dd7a7fad32d /base
parentf4078cf39908bfada67c0614ffc5ee8e4af765a2 (diff)
downloadchromium_src-672eca0fd191acd39c28430d1ed1f327594faff8.zip
chromium_src-672eca0fd191acd39c28430d1ed1f327594faff8.tar.gz
chromium_src-672eca0fd191acd39c28430d1ed1f327594faff8.tar.bz2
Reverting 23406.
It seems that Tab2OutOfTabStrip is failing consistently after this change. BUG=None TEST=None TBR=jhawkins@chromium.org Review URL: http://codereview.chromium.org/164543 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/window_impl.cc18
-rw-r--r--base/window_impl.h34
2 files changed, 28 insertions, 24 deletions
diff --git a/base/window_impl.cc b/base/window_impl.cc
index c3b3ad4..4a37f7b 100644
--- a/base/window_impl.cc
+++ b/base/window_impl.cc
@@ -96,7 +96,7 @@ class ClassRegistrar {
typedef std::list<RegisteredClass> RegisteredClasses;
RegisteredClasses registered_classes_;
- // Counter of how many classes have been registered so far.
+ // Counter of how many classes have ben registered so far.
int registered_count_;
DISALLOW_COPY_AND_ASSIGN(ClassRegistrar);
@@ -136,7 +136,7 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) {
height = bounds.height();
}
- hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), NULL,
+ hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"",
window_style_, x, y, width, height,
parent, NULL, NULL, this);
DCHECK(hwnd_);
@@ -145,17 +145,27 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) {
DCHECK(win_util::GetWindowUserData(hwnd_) == this);
}
+gfx::NativeView WindowImpl::GetNativeView() const {
+ return hwnd_;
+}
+
HICON WindowImpl::GetDefaultWindowIcon() const {
return NULL;
}
+BOOL WindowImpl::DestroyWindow() {
+ DCHECK(::IsWindow(GetNativeView()));
+ return ::DestroyWindow(GetNativeView());
+}
+
LRESULT WindowImpl::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
+ HWND window = GetNativeView();
LRESULT result = 0;
// Handle the message if it's in our message map; otherwise, let the system
// handle it.
- if (!ProcessWindowMessage(hwnd_, message, w_param, l_param, result))
- result = DefWindowProc(hwnd_, message, w_param, l_param);
+ if (!ProcessWindowMessage(window, message, w_param, l_param, result))
+ result = DefWindowProc(window, message, w_param, l_param);
return result;
}
diff --git a/base/window_impl.h b/base/window_impl.h
index 2941c3d9..30c6298 100644
--- a/base/window_impl.h
+++ b/base/window_impl.h
@@ -18,19 +18,6 @@
namespace base {
-// An interface implemented by classes that use message maps.
-// ProcessWindowMessage is implemented by the BEGIN_MESSAGE_MAP_EX macro.
-class MessageMapInterface {
- public:
- // Processes one message from the window's message queue.
- virtual BOOL ProcessWindowMessage(HWND window,
- UINT message,
- WPARAM w_param,
- LPARAM l_param,
- LRESULT& result,
- DWORD msg_mad_id = 0) = 0;
-};
-
///////////////////////////////////////////////////////////////////////////////
//
// WindowImpl
@@ -39,20 +26,24 @@ class MessageMapInterface {
// Windows.
//
///////////////////////////////////////////////////////////////////////////////
-class WindowImpl : public MessageMapInterface {
+class WindowImpl {
public:
WindowImpl();
virtual ~WindowImpl();
- // Initializes the Window with a parent and an initial desired size.
- void Init(HWND parent, const gfx::Rect& bounds);
+ BEGIN_MSG_MAP_EX(WindowImpl)
+ // No messages to handle
+ END_MSG_MAP()
+
+ // Initialize the Window with a parent and an initial desired size.
+ virtual void Init(HWND parent, const gfx::Rect& bounds);
+
+ // Returns the gfx::NativeView associated with this Window.
+ virtual gfx::NativeView GetNativeView() const;
// Retrieves the default window icon to use for windows if none is specified.
virtual HICON GetDefaultWindowIcon() const;
- // Returns the HWND associated with this Window.
- HWND hwnd() const { return hwnd_; }
-
// Sets the window styles. This is ONLY used when the window is created.
// In other words, if you invoke this after invoking Init, nothing happens.
void set_window_style(DWORD style) { window_style_ = style; }
@@ -71,13 +62,16 @@ class WindowImpl : public MessageMapInterface {
UINT initial_class_style() { return class_style_; }
protected:
+ // Call close instead of this to Destroy the window.
+ BOOL DestroyWindow();
+
// Handles the WndProc callback for this object.
virtual LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param);
private:
friend class ClassRegistrar;
- // The window procedure used by all Windows.
+ // The windows procedure used by all Windows.
static LRESULT CALLBACK WndProc(HWND window,
UINT message,
WPARAM w_param,