OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/frame/frame_border_hit_test.h" | 5 #include "ash/frame/frame_border_hit_test.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
9 #include "ash/wm_shell.h" | 9 #include "ash/shell_port.h" |
10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
12 #include "ui/views/widget/widget_delegate.h" | 12 #include "ui/views/widget/widget_delegate.h" |
13 #include "ui/views/window/non_client_view.h" | 13 #include "ui/views/window/non_client_view.h" |
14 | 14 |
15 namespace ash { | 15 namespace ash { |
16 | 16 |
17 int FrameBorderNonClientHitTest( | 17 int FrameBorderNonClientHitTest( |
18 views::NonClientFrameView* view, | 18 views::NonClientFrameView* view, |
19 FrameCaptionButtonContainerView* caption_button_container, | 19 FrameCaptionButtonContainerView* caption_button_container, |
20 const gfx::Point& point_in_widget) { | 20 const gfx::Point& point_in_widget) { |
21 gfx::Rect expanded_bounds = view->bounds(); | 21 gfx::Rect expanded_bounds = view->bounds(); |
22 int outside_bounds = kResizeOutsideBoundsSize; | 22 int outside_bounds = kResizeOutsideBoundsSize; |
23 | 23 |
24 if (WmShell::Get()->IsTouchDown()) | 24 if (ShellPort::Get()->IsTouchDown()) |
25 outside_bounds *= kResizeOutsideBoundsScaleForTouch; | 25 outside_bounds *= kResizeOutsideBoundsScaleForTouch; |
26 expanded_bounds.Inset(-outside_bounds, -outside_bounds); | 26 expanded_bounds.Inset(-outside_bounds, -outside_bounds); |
27 | 27 |
28 if (!expanded_bounds.Contains(point_in_widget)) | 28 if (!expanded_bounds.Contains(point_in_widget)) |
29 return HTNOWHERE; | 29 return HTNOWHERE; |
30 | 30 |
31 // Check the frame first, as we allow a small area overlapping the contents | 31 // Check the frame first, as we allow a small area overlapping the contents |
32 // to be used for resize handles. | 32 // to be used for resize handles. |
33 views::Widget* frame = view->GetWidget(); | 33 views::Widget* frame = view->GetWidget(); |
34 bool can_ever_resize = frame->widget_delegate()->CanResize(); | 34 bool can_ever_resize = frame->widget_delegate()->CanResize(); |
(...skipping 23 matching lines...) Expand all Loading... |
58 point_in_caption_button_container); | 58 point_in_caption_button_container); |
59 if (caption_button_component != HTNOWHERE) | 59 if (caption_button_component != HTNOWHERE) |
60 return caption_button_component; | 60 return caption_button_component; |
61 } | 61 } |
62 | 62 |
63 // Caption is a safe default. | 63 // Caption is a safe default. |
64 return HTCAPTION; | 64 return HTCAPTION; |
65 } | 65 } |
66 | 66 |
67 } // namespace ash | 67 } // namespace ash |
OLD | NEW |