OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/window/native_frame_view.h" | 5 #include "views/window/native_frame_view.h" |
6 | 6 |
7 #include "views/window/window_win.h" | 7 #include "views/widget/widget_win.h" |
| 8 #include "views/window/native_window.h" |
| 9 #include "views/window/window.h" |
8 | 10 |
9 namespace views { | 11 namespace views { |
10 | 12 |
11 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
12 // NativeFrameView, public: | 14 // NativeFrameView, public: |
13 | 15 |
14 NativeFrameView::NativeFrameView(WindowWin* frame) | 16 NativeFrameView::NativeFrameView(Window* frame) |
15 : NonClientFrameView(), | 17 : NonClientFrameView(), |
16 frame_(frame) { | 18 frame_(frame) { |
17 } | 19 } |
18 | 20 |
19 NativeFrameView::~NativeFrameView() { | 21 NativeFrameView::~NativeFrameView() { |
20 } | 22 } |
21 | 23 |
22 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
23 // NativeFrameView, NonClientFrameView overrides: | 25 // NativeFrameView, NonClientFrameView overrides: |
24 | 26 |
25 gfx::Rect NativeFrameView::GetBoundsForClientView() const { | 27 gfx::Rect NativeFrameView::GetBoundsForClientView() const { |
26 return gfx::Rect(0, 0, width(), height()); | 28 return gfx::Rect(0, 0, width(), height()); |
27 } | 29 } |
28 | 30 |
29 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( | 31 gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( |
30 const gfx::Rect& client_bounds) const { | 32 const gfx::Rect& client_bounds) const { |
31 RECT rect = client_bounds.ToRECT(); | 33 RECT rect = client_bounds.ToRECT(); |
32 AdjustWindowRectEx(&rect, frame_->window_style(), FALSE, | 34 WidgetWin* widget_win = |
33 frame_->window_ex_style()); | 35 static_cast<WidgetWin*>(frame_->native_window()->AsNativeWidget()); |
| 36 AdjustWindowRectEx(&rect, widget_win->window_style(), FALSE, |
| 37 widget_win->window_ex_style()); |
34 return gfx::Rect(rect); | 38 return gfx::Rect(rect); |
35 } | 39 } |
36 | 40 |
37 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { | 41 int NativeFrameView::NonClientHitTest(const gfx::Point& point) { |
38 return frame_->client_view()->NonClientHitTest(point); | 42 return frame_->client_view()->NonClientHitTest(point); |
39 } | 43 } |
40 | 44 |
41 void NativeFrameView::GetWindowMask(const gfx::Size& size, | 45 void NativeFrameView::GetWindowMask(const gfx::Size& size, |
42 gfx::Path* window_mask) { | 46 gfx::Path* window_mask) { |
43 // Nothing to do, we use the default window mask. | 47 // Nothing to do, we use the default window mask. |
(...skipping 12 matching lines...) Expand all Loading... |
56 } | 60 } |
57 | 61 |
58 gfx::Size NativeFrameView::GetPreferredSize() { | 62 gfx::Size NativeFrameView::GetPreferredSize() { |
59 gfx::Size pref = frame_->client_view()->GetPreferredSize(); | 63 gfx::Size pref = frame_->client_view()->GetPreferredSize(); |
60 gfx::Rect bounds(0, 0, pref.width(), pref.height()); | 64 gfx::Rect bounds(0, 0, pref.width(), pref.height()); |
61 return frame_->non_client_view()->GetWindowBoundsForClientBounds( | 65 return frame_->non_client_view()->GetWindowBoundsForClientBounds( |
62 bounds).size(); | 66 bounds).size(); |
63 } | 67 } |
64 | 68 |
65 } // namespace views | 69 } // namespace views |
OLD | NEW |