diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-21 22:44:21 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-21 22:44:21 +0000 |
commit | 3b8a7f8e37e223f3cfbdb6893a3e372ba1e72bc2 (patch) | |
tree | dbcc9e25653efaa6d7b3fd0b646f56123f72f8f2 /views/controls | |
parent | 294b014b3743b8a359d423ab238d2ea2872cf629 (diff) | |
download | chromium_src-3b8a7f8e37e223f3cfbdb6893a3e372ba1e72bc2.zip chromium_src-3b8a7f8e37e223f3cfbdb6893a3e372ba1e72bc2.tar.gz chromium_src-3b8a7f8e37e223f3cfbdb6893a3e372ba1e72bc2.tar.bz2 |
Attempt 2 at:
Converts usage of SetProp/GetProp to a map. Even after making sure we
clean up props we still leak in a handful of cases that are causing
test grief. By and large our usage of properties is for inside the
application, so that a map works fine.
BUG=61528 44991
TEST=none
TBR=cpu@chromium.org
Review URL: http://codereview.chromium.org/5144005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/native_control.cc | 15 | ||||
-rw-r--r-- | views/controls/native_control_win.cc | 13 | ||||
-rw-r--r-- | views/controls/native_control_win.h | 8 |
3 files changed, 18 insertions, 18 deletions
diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index ef719c9..13881bb 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -13,7 +13,7 @@ #include "app/keyboard_code_conversion_win.h" #include "app/keyboard_codes.h" #include "app/l10n_util_win.h" -#include "app/win/scoped_prop.h" +#include "app/view_prop.h" #include "base/logging.h" #include "base/scoped_ptr.h" #include "base/win_util.h" @@ -24,10 +24,12 @@ #include "views/focus/focus_manager.h" #include "views/widget/widget.h" +using app::ViewProp; + namespace views { // Maps to the NativeControl. -static const wchar_t* const kNativeControlKey = L"__NATIVE_CONTROL__"; +static const char* const kNativeControlKey = "__NATIVE_CONTROL__"; class NativeControlContainer : public CWindowImpl<NativeControlContainer, CWindow, @@ -89,8 +91,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer, // We subclass the control hwnd so we get the WM_KEYDOWN messages. original_handler_ = win_util::SetWindowProc( control_, &NativeControl::NativeControlWndProc); - prop_.reset( - new app::win::ScopedProp(control_, kNativeControlKey , parent_)); + prop_.reset(new ViewProp(control_, kNativeControlKey , parent_)); ::ShowWindow(control_, SW_SHOW); return 1; @@ -166,7 +167,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer, // Message handler that was set before we reset it. WNDPROC original_handler_; - scoped_ptr<app::win::ScopedProp> prop_; + scoped_ptr<ViewProp> prop_; DISALLOW_COPY_AND_ASSIGN(NativeControlContainer); }; @@ -363,8 +364,8 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, WPARAM w_param, LPARAM l_param) { - NativeControl* native_control = - static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); + NativeControl* native_control = static_cast<NativeControl*>( + ViewProp::GetValue(window, kNativeControlKey)); DCHECK(native_control); WNDPROC original_handler = native_control->container_->original_handler_; DCHECK(original_handler); diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index c4f811c..a223993 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -7,14 +7,16 @@ #include <windowsx.h> #include "app/l10n_util_win.h" -#include "app/win/scoped_prop.h" +#include "app/view_prop.h" #include "base/logging.h" #include "base/win_util.h" #include "views/focus/focus_manager.h" +using app::ViewProp; + namespace views { -static const wchar_t* kNativeControlWinKey = L"__NATIVE_CONTROL_WIN__"; +static const char* const kNativeControlWinKey = "__NATIVE_CONTROL_WIN__"; //////////////////////////////////////////////////////////////////////////////// // NativeControlWin, public: @@ -130,8 +132,7 @@ void NativeControlWin::ShowContextMenu(const gfx::Point& location) { void NativeControlWin::NativeControlCreated(HWND native_control) { // Associate this object with the control's HWND so that WidgetWin can find // this object when it receives messages from it. - props_.push_back( - new app::win::ScopedProp(native_control, kNativeControlWinKey, this)); + props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this)); props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages. @@ -196,8 +197,8 @@ LRESULT NativeControlWin::NativeControlWndProc(HWND window, UINT message, WPARAM w_param, LPARAM l_param) { - NativeControlWin* native_control = - static_cast<NativeControlWin*>(GetProp(window, kNativeControlWinKey)); + NativeControlWin* native_control = reinterpret_cast<NativeControlWin*>( + ViewProp::GetValue(window, kNativeControlWinKey)); DCHECK(native_control); if (message == WM_KEYDOWN && diff --git a/views/controls/native_control_win.h b/views/controls/native_control_win.h index 3733a15..d27efa4 100644 --- a/views/controls/native_control_win.h +++ b/views/controls/native_control_win.h @@ -13,9 +13,7 @@ #include "views/widget/child_window_message_processor.h" namespace app { -namespace win { -class ScopedProp; -} +class ViewProp; } namespace views { @@ -75,7 +73,7 @@ class NativeControlWin : public ChildWindowMessageProcessor, DWORD GetAdditionalRTLStyle() const; private: - typedef ScopedVector<app::win::ScopedProp> ScopedProps; + typedef ScopedVector<app::ViewProp> ViewProps; // Called by the containing WidgetWin when a message of type WM_CTLCOLORBTN or // WM_CTLCOLORSTATIC is sent from the HWND created by an object dreived from @@ -91,7 +89,7 @@ class NativeControlWin : public ChildWindowMessageProcessor, // The window procedure before we subclassed. WNDPROC original_wndproc_; - ScopedProps props_; + ViewProps props_; DISALLOW_COPY_AND_ASSIGN(NativeControlWin); }; |