OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h" | 5 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h" |
6 | 6 |
7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
8 #include "ui/base/hit_test.h" | 8 #include "ui/base/hit_test.h" |
9 #include "ui/gfx/win/dpi.h" | 9 #include "ui/gfx/win/dpi.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 gfx::Insets insets = GetGlassInsets(); | 49 gfx::Insets insets = GetGlassInsets(); |
50 return gfx::Rect(insets.left(), | 50 return gfx::Rect(insets.left(), |
51 insets.top(), | 51 insets.top(), |
52 std::max(0, width() - insets.left() - insets.right()), | 52 std::max(0, width() - insets.left() - insets.right()), |
53 std::max(0, height() - insets.top() - insets.bottom())); | 53 std::max(0, height() - insets.top() - insets.bottom())); |
54 } | 54 } |
55 | 55 |
56 gfx::Rect GlassAppWindowFrameViewWin::GetWindowBoundsForClientBounds( | 56 gfx::Rect GlassAppWindowFrameViewWin::GetWindowBoundsForClientBounds( |
57 const gfx::Rect& client_bounds) const { | 57 const gfx::Rect& client_bounds) const { |
58 gfx::Insets insets = GetGlassInsets(); | 58 gfx::Insets insets = GetGlassInsets(); |
| 59 // Our bounds are not the same as the window's due to the offset added by |
| 60 // AppWindowDesktopWindowTreeHostWin::GetClientAreaInsets. So account for it |
| 61 // here. |
| 62 insets += gfx::Insets(0, 0, 1, 1); |
59 return gfx::Rect(client_bounds.x() - insets.left(), | 63 return gfx::Rect(client_bounds.x() - insets.left(), |
60 client_bounds.y() - insets.top(), | 64 client_bounds.y() - insets.top(), |
61 client_bounds.width() + insets.left() + insets.right(), | 65 client_bounds.width() + insets.left() + insets.right(), |
62 client_bounds.height() + insets.top() + insets.bottom()); | 66 client_bounds.height() + insets.top() + insets.bottom()); |
63 } | 67 } |
64 | 68 |
65 int GlassAppWindowFrameViewWin::NonClientHitTest(const gfx::Point& point) { | 69 int GlassAppWindowFrameViewWin::NonClientHitTest(const gfx::Point& point) { |
66 if (widget_->IsFullscreen()) | 70 if (widget_->IsFullscreen()) |
67 return HTCLIENT; | 71 return HTCLIENT; |
68 | 72 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ->GetWindowBoundsForClientBounds(bounds) | 111 ->GetWindowBoundsForClientBounds(bounds) |
108 .size(); | 112 .size(); |
109 } | 113 } |
110 | 114 |
111 const char* GlassAppWindowFrameViewWin::GetClassName() const { | 115 const char* GlassAppWindowFrameViewWin::GetClassName() const { |
112 return kViewClassName; | 116 return kViewClassName; |
113 } | 117 } |
114 | 118 |
115 gfx::Size GlassAppWindowFrameViewWin::GetMinimumSize() const { | 119 gfx::Size GlassAppWindowFrameViewWin::GetMinimumSize() const { |
116 gfx::Size min_size = widget_->client_view()->GetMinimumSize(); | 120 gfx::Size min_size = widget_->client_view()->GetMinimumSize(); |
| 121 |
117 gfx::Rect client_bounds = GetBoundsForClientView(); | 122 gfx::Rect client_bounds = GetBoundsForClientView(); |
118 min_size.Enlarge(0, client_bounds.y()); | 123 min_size.Enlarge(width() - client_bounds.width(), |
| 124 height() - client_bounds.height()); |
119 return min_size; | 125 return min_size; |
120 } | 126 } |
121 | 127 |
122 gfx::Size GlassAppWindowFrameViewWin::GetMaximumSize() const { | 128 gfx::Size GlassAppWindowFrameViewWin::GetMaximumSize() const { |
123 gfx::Size max_size = widget_->client_view()->GetMaximumSize(); | 129 gfx::Size max_size = widget_->client_view()->GetMaximumSize(); |
124 | 130 |
125 // Add to the client maximum size the height of any title bar and borders. | 131 // Add to the client maximum size the height of any title bar and borders. |
126 gfx::Size client_size = GetBoundsForClientView().size(); | 132 gfx::Size client_size = GetBoundsForClientView().size(); |
127 if (max_size.width()) | 133 if (max_size.width()) |
128 max_size.Enlarge(width() - client_size.width(), 0); | 134 max_size.Enlarge(width() - client_size.width(), 0); |
129 if (max_size.height()) | 135 if (max_size.height()) |
130 max_size.Enlarge(0, height() - client_size.height()); | 136 max_size.Enlarge(0, height() - client_size.height()); |
131 | 137 |
132 return max_size; | 138 return max_size; |
133 } | 139 } |
OLD | NEW |