| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/window/native_frame_view.h" | 5 #include "ui/views/window/native_frame_view.h" |
| 6 | 6 |
| 7 #include "ui/views/widget/native_widget.h" | 7 #include "ui/views/widget/native_widget.h" |
| 8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 11 #include "ui/views/widget/native_widget_win.h" | |
| 12 #endif | |
| 13 | |
| 14 namespace views { | 10 namespace views { |
| 15 | 11 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
| 17 // NativeFrameView, public: | 13 // NativeFrameView, public: |
| 18 | 14 |
| 19 NativeFrameView::NativeFrameView(Widget* frame) | 15 NativeFrameView::NativeFrameView(Widget* frame) |
| 20 : NonClientFrameView(), | 16 : NonClientFrameView(), |
| 21 frame_(frame) { | 17 frame_(frame) { |
| 22 } | 18 } |
| 23 | 19 |
| 24 NativeFrameView::~NativeFrameView() { | 20 NativeFrameView::~NativeFrameView() { |
| 25 } | 21 } |
| 26 | 22 |
| 27 //////////////////////////////////////////////////////////////////////////////// | 23 //////////////////////////////////////////////////////////////////////////////// |
| 28 // NativeFrameView, NonClientFrameView overrides: | 24 // NativeFrameView, NonClientFrameView overrides: |
| 29 | 25 |
| 30 gfx::Rect NativeFrameView::GetBoundsForClientView() const { | 26 gfx::Rect NativeFrameView::GetBoundsForClientView() const { |
| 31 return gfx::Rect(0, 0, width(), height()); | 27 return gfx::Rect(0, 0, width(), height()); |
| 32 } | 28 } |
| 33 | 29 |
| 34 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( | 30 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( |
| 35 const gfx::Rect& client_bounds) const { | 31 const gfx::Rect& client_bounds) const { |
| 36 #if defined(OS_WIN) && !defined(USE_AURA) | 32 #if defined(OS_WIN) && !defined(USE_AURA) |
| 37 RECT rect = client_bounds.ToRECT(); | 33 RECT rect = client_bounds.ToRECT(); |
| 38 NativeWidgetWin* widget_win = | 34 DWORD style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_STYLE); |
| 39 static_cast<NativeWidgetWin*>(frame_->native_widget()); | 35 DWORD ex_style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_EXSTYLE); |
| 40 AdjustWindowRectEx(&rect, widget_win->window_style(), FALSE, | 36 AdjustWindowRectEx(&rect, style, FALSE, ex_style); |
| 41 widget_win->window_ex_style()); | |
| 42 return gfx::Rect(rect); | 37 return gfx::Rect(rect); |
| 43 #else | 38 #else |
| 44 // TODO(sad): | 39 // TODO(sad): |
| 45 return client_bounds; | 40 return client_bounds; |
| 46 #endif | 41 #endif |
| 47 } | 42 } |
| 48 | 43 |
| 49 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { | 44 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { |
| 50 return frame_->client_view()->NonClientHitTest(point); | 45 return frame_->client_view()->NonClientHitTest(point); |
| 51 } | 46 } |
| 52 | 47 |
| 53 void NativeFrameView::GetWindowMask(const gfx::Size& size, | 48 void NativeFrameView::GetWindowMask(const gfx::Size& size, |
| 54 gfx::Path* window_mask) { | 49 gfx::Path* window_mask) { |
| 55 // Nothing to do, we use the default window mask. | 50 // Nothing to do, we use the default window mask. |
| 56 } | 51 } |
| 57 | 52 |
| 58 void NativeFrameView::ResetWindowControls() { | 53 void NativeFrameView::ResetWindowControls() { |
| 59 // Nothing to do. | 54 // Nothing to do. |
| 60 } | 55 } |
| 61 | 56 |
| 62 void NativeFrameView::UpdateWindowIcon() { | 57 void NativeFrameView::UpdateWindowIcon() { |
| 63 // Nothing to do. | 58 // Nothing to do. |
| 64 } | 59 } |
| 65 | 60 |
| 66 gfx::Size NativeFrameView::GetPreferredSize() { | 61 gfx::Size NativeFrameView::GetPreferredSize() { |
| 67 return frame_->client_view()->GetPreferredSize(); | 62 return frame_->client_view()->GetPreferredSize(); |
| 68 } | 63 } |
| 69 | 64 |
| 70 } // namespace views | 65 } // namespace views |
| OLD | NEW |