OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gestures/shelf_gesture_handler.h" | 5 #include "ash/wm/gestures/shelf_gesture_handler.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/session_state_delegate.h" | 8 #include "ash/session_state_delegate.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/system/status_area_widget.h" | 13 #include "ash/system/status_area_widget.h" |
14 #include "ash/wm/gestures/tray_gesture_handler.h" | 14 #include "ash/wm/gestures/tray_gesture_handler.h" |
| 15 #include "ash/wm/window_properties.h" |
15 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
17 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
18 #include "ui/compositor/scoped_layer_animation_settings.h" | 19 #include "ui/compositor/scoped_layer_animation_settings.h" |
19 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
21 | 22 |
22 namespace ash { | 23 namespace ash { |
23 namespace internal { | 24 namespace internal { |
24 | 25 |
25 ShelfGestureHandler::ShelfGestureHandler() | 26 ShelfGestureHandler::ShelfGestureHandler() |
26 : drag_in_progress_(false) { | 27 : drag_in_progress_(false) { |
27 } | 28 } |
28 | 29 |
29 ShelfGestureHandler::~ShelfGestureHandler() { | 30 ShelfGestureHandler::~ShelfGestureHandler() { |
30 } | 31 } |
31 | 32 |
32 bool ShelfGestureHandler::ProcessGestureEvent(const ui::GestureEvent& event) { | 33 bool ShelfGestureHandler::ProcessGestureEvent(const ui::GestureEvent& event) { |
33 Shell* shell = Shell::GetInstance(); | 34 Shell* shell = Shell::GetInstance(); |
34 if (!shell->session_state_delegate()->NumberOfLoggedInUsers() || | 35 if (!shell->session_state_delegate()->NumberOfLoggedInUsers() || |
35 shell->session_state_delegate()->IsScreenLocked()) { | 36 shell->session_state_delegate()->IsScreenLocked()) { |
36 // The gestures are disabled in the lock/login screen. | 37 // The gestures are disabled in the lock/login screen. |
37 return false; | 38 return false; |
38 } | 39 } |
39 | 40 |
40 // The gesture are disabled for fullscreen windows. | 41 // TODO(oshima): Find the root window controller from event's location. |
41 aura::Window* active = wm::GetActiveWindow(); | 42 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); |
42 if (active && wm::IsWindowFullscreen(active)) | 43 |
| 44 ShelfLayoutManager* shelf = controller->GetShelfLayoutManager(); |
| 45 |
| 46 // The gesture are disabled for fullscreen windows that are not in immersive |
| 47 // mode. |
| 48 aura::Window* fullscreen = controller->GetFullscreenWindow(); |
| 49 if (fullscreen && !shelf->FullscreenWithMinimalChrome()) |
43 return false; | 50 return false; |
44 | 51 |
45 // TODO(oshima): Find the root window controller from event's location. | |
46 ShelfLayoutManager* shelf = | |
47 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | |
48 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 52 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
49 drag_in_progress_ = true; | 53 drag_in_progress_ = true; |
50 shelf->StartGestureDrag(event); | 54 shelf->StartGestureDrag(event); |
51 return true; | 55 return true; |
52 } | 56 } |
53 | 57 |
54 if (!drag_in_progress_) | 58 if (!drag_in_progress_) |
55 return false; | 59 return false; |
56 | 60 |
57 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { | 61 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { |
(...skipping 21 matching lines...) Expand all Loading... |
79 return true; | 83 return true; |
80 } | 84 } |
81 | 85 |
82 // Unexpected event. Reset the state and let the event fall through. | 86 // Unexpected event. Reset the state and let the event fall through. |
83 shelf->CancelGestureDrag(); | 87 shelf->CancelGestureDrag(); |
84 return false; | 88 return false; |
85 } | 89 } |
86 | 90 |
87 } // namespace internal | 91 } // namespace internal |
88 } // namespace ash | 92 } // namespace ash |
OLD | NEW |