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

Unified Diff: ui/views/widget/native_widget_win.cc

Issue 9254046: Custom frame UI for platform apps on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots Created 8 years, 10 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
Index: ui/views/widget/native_widget_win.cc
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index 8ce9e9249df0bc5742541146c286dd8fe7ef3c79..a63cdade8f1f60c499f8aa1468c1de60be79c509 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -1292,6 +1292,9 @@ LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) {
// We should attach IMEs only when we need to input CJK strings.
ImmAssociateContextEx(hwnd(), NULL, 0);
+ if (remove_standard_frame_)
+ SendFrameChanged(GetNativeView());
+
// We need to allow the delegate to size its contents since the window may not
// receive a size notification when its initial bounds are specified at window
// creation time.
@@ -1641,9 +1644,11 @@ LRESULT NativeWidgetWin::OnNCActivate(BOOL active) {
LRESULT NativeWidgetWin::OnNCCalcSize(BOOL mode, LPARAM l_param) {
// 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.
+ // custom width, but in fullscreen mode or when the NonClientFrameView
+ // requests it, we want a custom width of 0.
gfx::Insets insets = GetClientAreaInsets();
- if (insets.empty() && !IsFullscreen()) {
+ if (insets.empty() && !IsFullscreen() &&
+ !(mode && remove_standard_frame_)) {
SetMsgHandled(FALSE);
return 0;
}
@@ -1728,7 +1733,7 @@ LRESULT NativeWidgetWin::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 (GetWidget()->ShouldUseNativeFrame()) {
+ if (!remove_standard_frame_ && GetWidget()->ShouldUseNativeFrame()) {
LRESULT result;
if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0,
MAKELPARAM(point.x, point.y), &result)) {
@@ -2094,6 +2099,8 @@ void NativeWidgetWin::OnWindowPosChanging(WINDOWPOS* window_pos) {
void NativeWidgetWin::OnWindowPosChanged(WINDOWPOS* window_pos) {
if (DidClientAreaSizeChange(window_pos))
ClientAreaSizeChanged();
+ if (remove_standard_frame_ && window_pos->flags & SWP_FRAMECHANGED)
+ UpdateDWMFrame();
if (window_pos->flags & SWP_SHOWWINDOW)
delegate_->OnNativeWidgetVisibilityChanged(true);
else if (window_pos->flags & SWP_HIDEWINDOW)
@@ -2303,6 +2310,7 @@ void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) {
set_window_ex_style(window_ex_style() | ex_style);
has_non_client_view_ = Widget::RequiresNonClientView(params.type);
+ remove_standard_frame_ = params.remove_standard_frame;
}
void NativeWidgetWin::RedrawInvalidRect() {
@@ -2376,6 +2384,11 @@ void NativeWidgetWin::ClientAreaSizeChanged() {
layered_window_contents_.reset(new gfx::CanvasSkia(s, false));
}
+void NativeWidgetWin::UpdateDWMFrame() {
+ MARGINS m = {10, 10, 10, 10};
+ DwmExtendFrameIntoClientArea(GetNativeView(), &m);
+}
+
void NativeWidgetWin::ResetWindowRegion(bool force) {
// A native frame uses the native window region, and we don't want to mess
// with it.

Powered by Google App Engine
This is Rietveld 408576698