Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: ash/wm/gestures/shelf_gesture_handler.cc

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/shelf/shelf_types.h" 8 #include "ash/common/shelf/shelf_types.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/common/wm_shell.h"
10 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
11 #include "ash/shelf/shelf_layout_manager.h" 12 #include "ash/shelf/shelf_layout_manager.h"
12 #include "ash/shelf/shelf_widget.h" 13 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h"
14 #include "ash/system/status_area_widget.h" 14 #include "ash/system/status_area_widget.h"
15 #include "ash/wm/window_state_aura.h" 15 #include "ash/wm/window_state_aura.h"
16 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/compositor/layer.h" 18 #include "ui/compositor/layer.h"
19 #include "ui/compositor/scoped_layer_animation_settings.h" 19 #include "ui/compositor/scoped_layer_animation_settings.h"
20 #include "ui/gfx/transform.h" 20 #include "ui/gfx/transform.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 namespace ash { 23 namespace ash {
24 24
25 ShelfGestureHandler::ShelfGestureHandler() : drag_in_progress_(false) {} 25 ShelfGestureHandler::ShelfGestureHandler() : drag_in_progress_(false) {}
26 26
27 ShelfGestureHandler::~ShelfGestureHandler() {} 27 ShelfGestureHandler::~ShelfGestureHandler() {}
28 28
29 bool ShelfGestureHandler::ProcessGestureEvent( 29 bool ShelfGestureHandler::ProcessGestureEvent(
30 const ui::GestureEvent& event, 30 const ui::GestureEvent& event,
31 const aura::Window* event_target_window) { 31 const aura::Window* event_target_window) {
32 Shell* shell = Shell::GetInstance(); 32 // The gestures are disabled in the lock/login screen.
33 if (!shell->session_state_delegate()->NumberOfLoggedInUsers() || 33 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
34 shell->session_state_delegate()->IsScreenLocked()) { 34 if (!delegate->NumberOfLoggedInUsers() || delegate->IsScreenLocked())
35 // The gestures are disabled in the lock/login screen.
36 return false; 35 return false;
37 }
38 36
39 RootWindowController* controller = 37 RootWindowController* controller =
40 RootWindowController::ForWindow(event_target_window); 38 RootWindowController::ForWindow(event_target_window);
41 ShelfLayoutManager* shelf = controller->GetShelfLayoutManager(); 39 ShelfLayoutManager* shelf = controller->GetShelfLayoutManager();
42 40
43 if (event.type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE) { 41 if (event.type() == ui::ET_GESTURE_WIN8_EDGE_SWIPE) {
44 shelf->OnGestureEdgeSwipe(event); 42 shelf->OnGestureEdgeSwipe(event);
45 return true; 43 return true;
46 } 44 }
47 45
48 const aura::Window* fullscreen = controller->GetWindowForFullscreenMode(); 46 const aura::Window* fullscreen = controller->GetWindowForFullscreenMode();
49 if (fullscreen && 47 if (fullscreen &&
50 ash::wm::GetWindowState(fullscreen)->hide_shelf_when_fullscreen()) { 48 wm::GetWindowState(fullscreen)->hide_shelf_when_fullscreen()) {
51 return false; 49 return false;
52 } 50 }
53 51
54 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { 52 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) {
55 drag_in_progress_ = true; 53 drag_in_progress_ = true;
56 shelf->StartGestureDrag(event); 54 shelf->StartGestureDrag(event);
57 return true; 55 return true;
58 } 56 }
59 57
60 if (!drag_in_progress_) 58 if (!drag_in_progress_)
(...skipping 11 matching lines...) Expand all
72 shelf->CompleteGestureDrag(event); 70 shelf->CompleteGestureDrag(event);
73 return true; 71 return true;
74 } 72 }
75 73
76 // Unexpected event. Reset the state and let the event fall through. 74 // Unexpected event. Reset the state and let the event fall through.
77 shelf->CancelGestureDrag(); 75 shelf->CancelGestureDrag();
78 return false; 76 return false;
79 } 77 }
80 78
81 } // namespace ash 79 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698