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 "ash/wm/resize_handle_window_targeter.h" | 5 #include "ash/wm/resize_handle_window_targeter.h" |
6 | 6 |
7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
9 #include "ash/wm/immersive_fullscreen_controller.h" | 9 #include "ash/shared/immersive_fullscreen_controller.h" |
10 #include "ash/wm/window_state_aura.h" | 10 #include "ash/wm/window_state_aura.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 | 15 |
16 ResizeHandleWindowTargeter::ResizeHandleWindowTargeter( | 16 ResizeHandleWindowTargeter::ResizeHandleWindowTargeter( |
17 aura::Window* window, | 17 aura::Window* window, |
18 WmImmersiveFullscreenController* controller) | 18 ImmersiveFullscreenController* controller) |
19 : window_(window), immersive_controller_(controller) { | 19 : window_(window), immersive_controller_(controller) { |
20 wm::WindowState* window_state = wm::GetWindowState(window_); | 20 wm::WindowState* window_state = wm::GetWindowState(window_); |
21 OnPostWindowStateTypeChange(window_state, wm::WINDOW_STATE_TYPE_DEFAULT); | 21 OnPostWindowStateTypeChange(window_state, wm::WINDOW_STATE_TYPE_DEFAULT); |
22 window_state->AddObserver(this); | 22 window_state->AddObserver(this); |
23 window_->AddObserver(this); | 23 window_->AddObserver(this); |
24 } | 24 } |
25 | 25 |
26 ResizeHandleWindowTargeter::~ResizeHandleWindowTargeter() { | 26 ResizeHandleWindowTargeter::~ResizeHandleWindowTargeter() { |
27 if (window_) { | 27 if (window_) { |
28 window_->RemoveObserver(this); | 28 window_->RemoveObserver(this); |
(...skipping 25 matching lines...) Expand all Loading... |
54 if (window == window_) { | 54 if (window == window_) { |
55 gfx::Insets insets; | 55 gfx::Insets insets; |
56 if (immersive_controller_ && immersive_controller_->IsEnabled() && | 56 if (immersive_controller_ && immersive_controller_->IsEnabled() && |
57 !immersive_controller_->IsRevealed() && event->IsTouchEvent()) { | 57 !immersive_controller_->IsRevealed() && event->IsTouchEvent()) { |
58 // If the window is in immersive fullscreen, and top-of-window views are | 58 // If the window is in immersive fullscreen, and top-of-window views are |
59 // not revealed, then touch events towards the top of the window | 59 // not revealed, then touch events towards the top of the window |
60 // should not reach the child window so that touch gestures can be used to | 60 // should not reach the child window so that touch gestures can be used to |
61 // reveal the top-of-windows views. This is needed because the child | 61 // reveal the top-of-windows views. This is needed because the child |
62 // window may consume touch events and prevent touch-scroll gesture from | 62 // window may consume touch events and prevent touch-scroll gesture from |
63 // being generated. | 63 // being generated. |
64 insets = gfx::Insets(kImmersiveFullscreenTopEdgeInset, 0, 0, 0); | 64 insets = gfx::Insets( |
| 65 ImmersiveFullscreenController::kImmersiveFullscreenTopEdgeInset, 0, 0, |
| 66 0); |
65 } else { | 67 } else { |
66 // If the event falls very close to the inside of the frame border, then | 68 // If the event falls very close to the inside of the frame border, then |
67 // target the window itself, so that the window can be resized easily. | 69 // target the window itself, so that the window can be resized easily. |
68 insets = frame_border_inset_; | 70 insets = frame_border_inset_; |
69 } | 71 } |
70 | 72 |
71 if (!insets.IsEmpty()) { | 73 if (!insets.IsEmpty()) { |
72 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); | 74 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); |
73 bounds.Inset(insets); | 75 bounds.Inset(insets); |
74 if (!bounds.Contains(event->location())) | 76 if (!bounds.Contains(event->location())) |
(...skipping 15 matching lines...) Expand all Loading... |
90 aura::WindowTargeter* targeter = | 92 aura::WindowTargeter* targeter = |
91 static_cast<aura::WindowTargeter*>(parent->GetEventTargeter()); | 93 static_cast<aura::WindowTargeter*>(parent->GetEventTargeter()); |
92 if (targeter) | 94 if (targeter) |
93 return targeter->SubtreeShouldBeExploredForEvent(window, event); | 95 return targeter->SubtreeShouldBeExploredForEvent(window, event); |
94 } | 96 } |
95 } | 97 } |
96 return aura::WindowTargeter::SubtreeShouldBeExploredForEvent(window, event); | 98 return aura::WindowTargeter::SubtreeShouldBeExploredForEvent(window, event); |
97 } | 99 } |
98 | 100 |
99 } // namespace ash | 101 } // namespace ash |
OLD | NEW |