| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/non_client_view.h" | 5 #include "chrome/views/non_client_view.h" |
| 6 | 6 |
| 7 namespace views { | 7 namespace views { |
| 8 | 8 |
| 9 int NonClientView::GetHTComponentForFrame(const gfx::Point& point, | 9 int NonClientView::GetHTComponentForFrame(const gfx::Point& point, |
| 10 int resize_area_size, | 10 int top_resize_border_height, |
| 11 int resize_area_corner_size, | 11 int resize_border_width, |
| 12 int top_resize_area_size, | 12 int bottom_resize_border_height, |
| 13 int resize_corner_size, |
| 13 bool can_resize) { | 14 bool can_resize) { |
| 14 int component = HTNOWHERE; | 15 int component = HTNOWHERE; |
| 15 if (point.x() < resize_area_size) { | 16 if (point.x() < resize_border_width) { |
| 16 if (point.y() < resize_area_corner_size) { | 17 if (point.y() < resize_corner_size) { |
| 17 component = HTTOPLEFT; | 18 component = HTTOPLEFT; |
| 18 } else if (point.y() >= (height() - resize_area_corner_size)) { | 19 } else if (point.y() >= (height() - resize_corner_size)) { |
| 19 component = HTBOTTOMLEFT; | 20 component = HTBOTTOMLEFT; |
| 20 } else { | 21 } else { |
| 21 component = HTLEFT; | 22 component = HTLEFT; |
| 22 } | 23 } |
| 23 } else if (point.x() < resize_area_corner_size) { | 24 } else if (point.x() < resize_corner_size) { |
| 24 if (point.y() < top_resize_area_size) { | 25 if (point.y() < top_resize_border_height) { |
| 25 component = HTTOPLEFT; | 26 component = HTTOPLEFT; |
| 26 } else if (point.y() >= (height() - resize_area_size)) { | 27 } else if (point.y() >= (height() - bottom_resize_border_height)) { |
| 27 component = HTBOTTOMLEFT; | 28 component = HTBOTTOMLEFT; |
| 28 } | 29 } |
| 29 } else if (point.x() >= (width() - resize_area_size)) { | 30 } else if (point.x() >= (width() - resize_border_width)) { |
| 30 if (point.y() < resize_area_corner_size) { | 31 if (point.y() < resize_corner_size) { |
| 31 component = HTTOPRIGHT; | 32 component = HTTOPRIGHT; |
| 32 } else if (point.y() >= (height() - resize_area_corner_size)) { | 33 } else if (point.y() >= (height() - resize_corner_size)) { |
| 33 component = HTBOTTOMRIGHT; | 34 component = HTBOTTOMRIGHT; |
| 34 } else if (point.x() >= (width() - resize_area_size)) { | 35 } else { |
| 35 component = HTRIGHT; | 36 component = HTRIGHT; |
| 36 } | 37 } |
| 37 } else if (point.x() >= (width() - resize_area_corner_size)) { | 38 } else if (point.x() >= (width() - resize_corner_size)) { |
| 38 if (point.y() < top_resize_area_size) { | 39 if (point.y() < top_resize_border_height) { |
| 39 component = HTTOPRIGHT; | 40 component = HTTOPRIGHT; |
| 40 } else if (point.y() >= (height() - resize_area_size)) { | 41 } else if (point.y() >= (height() - bottom_resize_border_height)) { |
| 41 component = HTBOTTOMRIGHT; | 42 component = HTBOTTOMRIGHT; |
| 42 } | 43 } |
| 43 } else if (point.y() < top_resize_area_size) { | 44 } else if (point.y() < top_resize_border_height) { |
| 44 component = HTTOP; | 45 component = HTTOP; |
| 45 } else if (point.y() >= (height() - resize_area_size)) { | 46 } else if (point.y() >= (height() - bottom_resize_border_height)) { |
| 46 component = HTBOTTOM; | 47 component = HTBOTTOM; |
| 47 } | 48 } |
| 48 | 49 |
| 49 // If the window can't be resized, there are no resize boundaries, just | 50 // If the window can't be resized, there are no resize boundaries, just |
| 50 // window borders. | 51 // window borders. |
| 51 if (component != HTNOWHERE) | 52 if (component != HTNOWHERE) |
| 52 return can_resize ? component : HTBORDER; | 53 return can_resize ? component : HTBORDER; |
| 53 return HTNOWHERE; | 54 return HTNOWHERE; |
| 54 } | 55 } |
| 55 | 56 |
| 56 } // namespace views | 57 } // namespace views |
| 57 | 58 |
| OLD | NEW |