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

Unified Diff: views/window/window_win.cc

Issue 7036014: Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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/window/window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/window/window_win.cc
===================================================================
--- views/window/window_win.cc (revision 85647)
+++ views/window/window_win.cc (working copy)
@@ -310,7 +310,7 @@
gfx::Insets WindowWin::GetClientAreaInsets() const {
// Returning an empty Insets object causes the default handling in
// WidgetWin::OnNCCalcSize() to be invoked.
- if (delegate_->IsUsingNativeFrame())
+ if (GetWindow()->ShouldUseNativeFrame())
return gfx::Insets();
if (IsMaximized()) {
@@ -331,7 +331,7 @@
// rect when using the opaque frame.
// Note: this is only required for non-fullscreen windows. Note that
// fullscreen windows are in restored state, not maximized.
- return gfx::Insets(0, 0, IsFullscreen() ? 0 : 1, 0);
+ return gfx::Insets(0, 0, 0, 0);
}
int WindowWin::GetShowState() const {
@@ -414,7 +414,7 @@
WidgetWin::OnExitSizeMove();
delegate_->OnNativeWindowEndUserBoundsChange();
- if (!ShouldUseNativeFrame()) {
+ if (!GetWindow()->ShouldUseNativeFrame()) {
// Sending SWP_FRAMECHANGED forces a non-client repaint, which fixes the
// glitch in rendering the bottom pixel of the window caused by us
// offsetting the client rect there (See comment in GetClientAreaInsets()).
@@ -438,7 +438,7 @@
void WindowWin::OnInitMenu(HMENU menu) {
// We only need to manually enable the system menu if we're not using a native
// frame.
- if (delegate_->IsUsingNativeFrame())
+ if (GetWindow()->ShouldUseNativeFrame())
WidgetWin::OnInitMenu(menu);
bool is_fullscreen = IsFullscreen();
@@ -484,7 +484,8 @@
ExecuteSystemMenuCommand(id);
return 0;
}
- } else if (message == WM_NCLBUTTONDOWN && !delegate_->IsUsingNativeFrame()) {
+ } else if (message == WM_NCLBUTTONDOWN &&
+ !GetWindow()->ShouldUseNativeFrame()) {
switch (w_param) {
case HTCLOSE:
case HTMINBUTTON:
@@ -556,7 +557,7 @@
if (IsVisible())
GetWindow()->non_client_view()->SchedulePaint();
- if (!ShouldUseNativeFrame()) {
+ if (!GetWindow()->ShouldUseNativeFrame()) {
// TODO(beng, et al): Hack to redraw this window and child windows
// synchronously upon activation. Not all child windows are redrawing
// themselves leading to issues like http://crbug.com/74604
@@ -577,6 +578,7 @@
}
LRESULT WindowWin::OnNCCalcSize(BOOL mode, LPARAM l_param) {
+ //return 0;
// We only override the default handling if we need to specify a custom
// non-client edge width. Note that in most cases "no insets" means no
// custom width, but in fullscreen mode we want a custom width of 0.
@@ -618,7 +620,7 @@
if (EdgeHasTopmostAutoHideTaskbar(ABE_LEFT, monitor))
client_rect->left += kAutoHideTaskbarThicknessPx;
if (EdgeHasTopmostAutoHideTaskbar(ABE_TOP, monitor)) {
- if (delegate_->IsUsingNativeFrame()) {
+ if (GetWindow()->ShouldUseNativeFrame()) {
// Tricky bit. Due to a bug in DwmDefWindowProc()'s handling of
// WM_NCHITTEST, having any nonclient area atop the window causes the
// caption buttons to draw onscreen but not respond to mouse
@@ -659,7 +661,7 @@
LRESULT WindowWin::OnNCHitTest(const CPoint& point) {
// If the DWM is rendering the window controls, we need to give the DWM's
// default window procedure first chance to handle hit testing.
- if (ShouldUseNativeFrame()) {
+ if (GetWindow()->ShouldUseNativeFrame()) {
LRESULT result;
if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0,
MAKELPARAM(point.x, point.y), &result)) {
@@ -684,14 +686,14 @@
// When using a custom frame, we want to avoid calling DefWindowProc() since
// that may render artifacts.
SetMsgHandled((!IsActive() || is_in_size_move_) &&
- !delegate_->IsUsingNativeFrame());
+ !GetWindow()->ShouldUseNativeFrame());
}
LRESULT WindowWin::OnNCUAHDrawCaption(UINT msg, WPARAM w_param,
LPARAM l_param) {
// See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for
// an explanation about why we need to handle this message.
- SetMsgHandled(!delegate_->IsUsingNativeFrame());
+ SetMsgHandled(!GetWindow()->ShouldUseNativeFrame());
return 0;
}
@@ -699,7 +701,7 @@
LPARAM l_param) {
// See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for
// an explanation about why we need to handle this message.
- SetMsgHandled(!delegate_->IsUsingNativeFrame());
+ SetMsgHandled(!GetWindow()->ShouldUseNativeFrame());
return 0;
}
@@ -756,7 +758,7 @@
((notification_code & sc_mask) == SC_MOVE) ||
((notification_code & sc_mask) == SC_MAXIMIZE)))
return;
- if (!delegate_->IsUsingNativeFrame()) {
+ if (!GetWindow()->ShouldUseNativeFrame()) {
if ((notification_code & sc_mask) == SC_MINIMIZE ||
(notification_code & sc_mask) == SC_MAXIMIZE ||
(notification_code & sc_mask) == SC_RESTORE) {
@@ -1199,7 +1201,7 @@
}
NonClientFrameView* WindowWin::CreateFrameViewForWindow() {
- if (ShouldUseNativeFrame())
+ if (GetWindow()->ShouldUseNativeFrame())
return new NativeFrameView(GetWindow());
return new CustomFrameView(GetWindow());
}
@@ -1226,8 +1228,8 @@
// the DWM's glass non-client rendering is enabled, which is why
// DWMNCRP_ENABLED is used for the native frame case. _DISABLED means the
// DWM doesn't render glass, and so is used in the custom frame case.
- DWMNCRENDERINGPOLICY policy =
- delegate_->IsUsingNativeFrame() ? DWMNCRP_ENABLED : DWMNCRP_DISABLED;
+ DWMNCRENDERINGPOLICY policy = GetWindow()->ShouldUseNativeFrame() ?
+ DWMNCRP_ENABLED : DWMNCRP_DISABLED;
DwmSetWindowAttribute(GetNativeView(), DWMWA_NCRENDERING_POLICY,
&policy, sizeof(DWMNCRENDERINGPOLICY));
}
@@ -1301,7 +1303,7 @@
void WindowWin::ResetWindowRegion(bool force) {
// A native frame uses the native window region, and we don't want to mess
// with it.
- if (delegate_->IsUsingNativeFrame()) {
+ if (GetWindow()->ShouldUseNativeFrame()) {
if (force)
SetWindowRgn(NULL, TRUE);
return;
« no previous file with comments | « views/window/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698