OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/immersive_fullscreen_controller.h" | 5 #include "ash/shared/immersive_fullscreen_controller.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "ash/common/ash_constants.h" | |
10 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" | |
11 #include "ash/shared/immersive_context.h" | 9 #include "ash/shared/immersive_context.h" |
12 #include "ash/shared/immersive_focus_watcher.h" | 10 #include "ash/shared/immersive_focus_watcher.h" |
| 11 #include "ash/shared/immersive_fullscreen_controller_delegate.h" |
13 #include "ash/shared/immersive_gesture_handler.h" | 12 #include "ash/shared/immersive_gesture_handler.h" |
14 #include "ash/wm/immersive_handler_factory.h" | 13 #include "ash/shared/immersive_handler_factory.h" |
15 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
16 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
17 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
18 #include "ui/events/base_event_utils.h" | 17 #include "ui/events/base_event_utils.h" |
19 #include "ui/gfx/animation/slide_animation.h" | 18 #include "ui/gfx/animation/slide_animation.h" |
20 #include "ui/gfx/geometry/point.h" | 19 #include "ui/gfx/geometry/point.h" |
21 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/views/bubble/bubble_dialog_delegate.h" | 21 #include "ui/views/bubble/bubble_dialog_delegate.h" |
23 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
24 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
(...skipping 23 matching lines...) Expand all Loading... |
48 const int kSwipeVerticalThresholdMultiplier = 3; | 47 const int kSwipeVerticalThresholdMultiplier = 3; |
49 | 48 |
50 // The height in pixels of the region above the top edge of the display which | 49 // The height in pixels of the region above the top edge of the display which |
51 // hosts the immersive fullscreen window in which mouse events are ignored | 50 // hosts the immersive fullscreen window in which mouse events are ignored |
52 // (cannot reveal or unreveal the top-of-window views). | 51 // (cannot reveal or unreveal the top-of-window views). |
53 // See ShouldIgnoreMouseEventAtLocation() for more details. | 52 // See ShouldIgnoreMouseEventAtLocation() for more details. |
54 const int kHeightOfDeadRegionAboveTopContainer = 10; | 53 const int kHeightOfDeadRegionAboveTopContainer = 10; |
55 | 54 |
56 } // namespace | 55 } // namespace |
57 | 56 |
58 // The height in pixels of the region below the top edge of the display in which | 57 // static |
59 // the mouse can trigger revealing the top-of-window views. | 58 const int ImmersiveFullscreenController::kImmersiveFullscreenTopEdgeInset = 8; |
60 // The height must be greater than 1px because the top pixel is used to trigger | 59 |
61 // moving the cursor between displays if the user has a vertical display layout | 60 // static |
62 // (primary display above/below secondary display). | |
63 const int ImmersiveFullscreenController::kMouseRevealBoundsHeight = 3; | 61 const int ImmersiveFullscreenController::kMouseRevealBoundsHeight = 3; |
64 | 62 |
65 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
66 | 64 |
67 ImmersiveFullscreenController::ImmersiveFullscreenController() | 65 ImmersiveFullscreenController::ImmersiveFullscreenController() |
68 : delegate_(NULL), | 66 : delegate_(NULL), |
69 top_container_(NULL), | 67 top_container_(NULL), |
70 widget_(NULL), | 68 widget_(NULL), |
71 observers_enabled_(false), | 69 observers_enabled_(false), |
72 enabled_(false), | 70 enabled_(false), |
73 reveal_state_(CLOSED), | 71 reveal_state_(CLOSED), |
74 revealed_lock_count_(0), | 72 revealed_lock_count_(0), |
75 mouse_x_when_hit_top_in_screen_(-1), | 73 mouse_x_when_hit_top_in_screen_(-1), |
76 gesture_begun_(false), | 74 gesture_begun_(false), |
77 animation_(new gfx::SlideAnimation(this)), | 75 animation_(new gfx::SlideAnimation(this)), |
78 animations_disabled_for_test_(false), | 76 animations_disabled_for_test_(false), |
79 weak_ptr_factory_(this) {} | 77 weak_ptr_factory_(this) {} |
80 | 78 |
81 ImmersiveFullscreenController::~ImmersiveFullscreenController() { | 79 ImmersiveFullscreenController::~ImmersiveFullscreenController() { |
82 EnableWindowObservers(false); | 80 EnableWindowObservers(false); |
83 } | 81 } |
84 | 82 |
85 void ImmersiveFullscreenController::Init( | 83 void ImmersiveFullscreenController::Init( |
86 WmImmersiveFullscreenControllerDelegate* delegate, | 84 ImmersiveFullscreenControllerDelegate* delegate, |
87 views::Widget* widget, | 85 views::Widget* widget, |
88 views::View* top_container) { | 86 views::View* top_container) { |
89 delegate_ = delegate; | 87 delegate_ = delegate; |
90 top_container_ = top_container; | 88 top_container_ = top_container; |
91 widget_ = widget; | 89 widget_ = widget; |
92 ImmersiveContext::Get()->InstallResizeHandleWindowTargeter(this); | 90 ImmersiveContext::Get()->InstallResizeHandleWindowTargeter(this); |
93 } | 91 } |
94 | 92 |
95 void ImmersiveFullscreenController::SetEnabled(WindowType window_type, | 93 void ImmersiveFullscreenController::SetEnabled(WindowType window_type, |
96 bool enabled) { | 94 bool enabled) { |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 location.y() < hit_bounds_in_screen.y() && | 644 location.y() < hit_bounds_in_screen.y() && |
647 location.x() >= hit_bounds_in_screen.x() && | 645 location.x() >= hit_bounds_in_screen.x() && |
648 location.x() < hit_bounds_in_screen.right()); | 646 location.x() < hit_bounds_in_screen.right()); |
649 } | 647 } |
650 | 648 |
651 gfx::Rect ImmersiveFullscreenController::GetDisplayBoundsInScreen() const { | 649 gfx::Rect ImmersiveFullscreenController::GetDisplayBoundsInScreen() const { |
652 return ImmersiveContext::Get()->GetDisplayBoundsInScreen(widget_); | 650 return ImmersiveContext::Get()->GetDisplayBoundsInScreen(widget_); |
653 } | 651 } |
654 | 652 |
655 } // namespace ash | 653 } // namespace ash |
OLD | NEW |