Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Unified Diff: views/controls/native_control_win.cc

Issue 114059: Refactors HWNDView, NativeViewHostGtk and NativeViewHost so that they match t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/native_control_win.h ('k') | views/controls/native_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/native_control_win.cc
===================================================================
--- views/controls/native_control_win.cc (revision 17161)
+++ views/controls/native_control_win.cc (working copy)
@@ -23,11 +23,11 @@
////////////////////////////////////////////////////////////////////////////////
// NativeControlWin, public:
-NativeControlWin::NativeControlWin() : HWNDView() {
+NativeControlWin::NativeControlWin() {
}
NativeControlWin::~NativeControlWin() {
- HWND hwnd = GetHWND();
+ HWND hwnd = native_view();
if (hwnd) {
// Destroy the hwnd if it still exists. Otherwise we won't have shut things
// down correctly, leading to leaking and crashing if another message
@@ -47,7 +47,7 @@
case WM_CTLCOLORBTN:
case WM_CTLCOLORSTATIC:
*result = GetControlColor(message, reinterpret_cast<HDC>(w_param),
- GetHWND());
+ native_view());
return true;
}
return false;
@@ -59,37 +59,37 @@
void NativeControlWin::SetEnabled(bool enabled) {
if (IsEnabled() != enabled) {
View::SetEnabled(enabled);
- if (GetHWND())
- EnableWindow(GetHWND(), IsEnabled());
+ if (native_view())
+ EnableWindow(native_view(), IsEnabled());
}
}
void NativeControlWin::ViewHierarchyChanged(bool is_add, View* parent,
View* child) {
+ // Call the base class to hide the view if we're being removed.
+ NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
+
// Create the HWND when we're added to a valid Widget. Many controls need a
// parent HWND to function properly.
- if (is_add && GetWidget() && !GetHWND())
+ if (is_add && GetWidget() && !native_view())
CreateNativeControl();
-
- // Call the base class to hide the view if we're being removed.
- HWNDView::ViewHierarchyChanged(is_add, parent, child);
}
void NativeControlWin::VisibilityChanged(View* starting_from, bool is_visible) {
if (!is_visible) {
// We destroy the child control HWND when we become invisible because of the
// performance cost of maintaining many HWNDs.
- HWND hwnd = GetHWND();
+ HWND hwnd = native_view();
Detach();
DestroyWindow(hwnd);
- } else if (!GetHWND()) {
+ } else if (!native_view()) {
CreateNativeControl();
}
}
void NativeControlWin::Focus() {
- DCHECK(GetHWND());
- SetFocus(GetHWND());
+ DCHECK(native_view());
+ SetFocus(native_view());
}
////////////////////////////////////////////////////////////////////////////////
@@ -123,13 +123,13 @@
SetProp(native_control, kNativeControlOriginalWndProcKey, original_wndproc_);
Attach(native_control);
- // GetHWND() is now valid.
+ // native_view() is now valid.
// Update the newly created HWND with any resident enabled state.
- EnableWindow(GetHWND(), IsEnabled());
+ EnableWindow(native_view(), IsEnabled());
// This message ensures that the focus border is shown.
- SendMessage(GetHWND(), WM_CHANGEUISTATE,
+ SendMessage(native_view(), WM_CHANGEUISTATE,
MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
}
« no previous file with comments | « views/controls/native_control_win.h ('k') | views/controls/native_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698