| 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) |
| 11 #include "ui/views/win/hwnd_util.h" |
| 12 #endif |
| 13 |
| 10 namespace views { | 14 namespace views { |
| 11 | 15 |
| 12 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
| 13 // NativeFrameView, public: | 17 // NativeFrameView, public: |
| 14 | 18 |
| 15 NativeFrameView::NativeFrameView(Widget* frame) | 19 NativeFrameView::NativeFrameView(Widget* frame) |
| 16 : NonClientFrameView(), | 20 : NonClientFrameView(), |
| 17 frame_(frame) { | 21 frame_(frame) { |
| 18 } | 22 } |
| 19 | 23 |
| 20 NativeFrameView::~NativeFrameView() { | 24 NativeFrameView::~NativeFrameView() { |
| 21 } | 25 } |
| 22 | 26 |
| 23 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 24 // NativeFrameView, NonClientFrameView overrides: | 28 // NativeFrameView, NonClientFrameView overrides: |
| 25 | 29 |
| 26 gfx::Rect NativeFrameView::GetBoundsForClientView() const { | 30 gfx::Rect NativeFrameView::GetBoundsForClientView() const { |
| 27 return gfx::Rect(0, 0, width(), height()); | 31 return gfx::Rect(0, 0, width(), height()); |
| 28 } | 32 } |
| 29 | 33 |
| 30 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( | 34 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( |
| 31 const gfx::Rect& client_bounds) const { | 35 const gfx::Rect& client_bounds) const { |
| 32 #if defined(OS_WIN) && !defined(USE_AURA) | 36 #if defined(OS_WIN) |
| 33 RECT rect = client_bounds.ToRECT(); | 37 return views::GetWindowBoundsForClientBounds( |
| 34 DWORD style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_STYLE); | 38 static_cast<View*>(const_cast<NativeFrameView*>(this)), client_bounds); |
| 35 DWORD ex_style = ::GetWindowLong(GetWidget()->GetNativeView(), GWL_EXSTYLE); | |
| 36 AdjustWindowRectEx(&rect, style, FALSE, ex_style); | |
| 37 return gfx::Rect(rect); | |
| 38 #else | 39 #else |
| 39 // TODO(sad): | 40 // TODO(sad): |
| 40 return client_bounds; | 41 return client_bounds; |
| 41 #endif | 42 #endif |
| 42 } | 43 } |
| 43 | 44 |
| 44 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { | 45 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { |
| 45 return frame_->client_view()->NonClientHitTest(point); | 46 return frame_->client_view()->NonClientHitTest(point); |
| 46 } | 47 } |
| 47 | 48 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 | 61 |
| 61 void NativeFrameView::UpdateWindowTitle() { | 62 void NativeFrameView::UpdateWindowTitle() { |
| 62 // Nothing to do. | 63 // Nothing to do. |
| 63 } | 64 } |
| 64 | 65 |
| 65 gfx::Size NativeFrameView::GetPreferredSize() { | 66 gfx::Size NativeFrameView::GetPreferredSize() { |
| 66 return frame_->client_view()->GetPreferredSize(); | 67 return frame_->client_view()->GetPreferredSize(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace views | 70 } // namespace views |
| OLD | NEW |