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

Side by Side Diff: ash/wm/tablet_mode/tablet_mode_event_handler.cc

Issue 2908793002: [mus+ash] Removes WmWindow from ash/wm/overview and ash/wm/workspace (Closed)
Patch Set: Created 3 years, 6 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 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/wm/tablet_mode/tablet_mode_event_handler.h" 5 #include "ash/wm/tablet_mode/tablet_mode_event_handler.h"
6 6
7 #include "ash/session/session_controller.h" 7 #include "ash/session/session_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "ash/wm/wm_event.h" 11 #include "ash/wm/wm_event.h"
12 #include "ash/wm_window.h"
13 #include "ui/events/event.h" 12 #include "ui/events/event.h"
14 13
15 namespace ash { 14 namespace ash {
16 namespace wm { 15 namespace wm {
17 namespace { 16 namespace {
18 17
19 // The height of the area in which a touch operation leads to exiting the 18 // The height of the area in which a touch operation leads to exiting the
20 // full screen mode. 19 // full screen mode.
21 const int kLeaveFullScreenAreaHeightInPixel = 2; 20 const int kLeaveFullScreenAreaHeightInPixel = 2;
22 21
23 } // namespace 22 } // namespace
24 23
25 TabletModeEventHandler::TabletModeEventHandler() {} 24 TabletModeEventHandler::TabletModeEventHandler() {}
26 25
27 TabletModeEventHandler::~TabletModeEventHandler() {} 26 TabletModeEventHandler::~TabletModeEventHandler() {}
28 27
29 bool TabletModeEventHandler::ToggleFullscreen(const ui::TouchEvent& event) { 28 bool TabletModeEventHandler::ToggleFullscreen(const ui::TouchEvent& event) {
30 if (event.type() != ui::ET_TOUCH_PRESSED) 29 if (event.type() != ui::ET_TOUCH_PRESSED)
31 return false; 30 return false;
32 31
33 const SessionController* controller = Shell::Get()->session_controller(); 32 const SessionController* controller = Shell::Get()->session_controller();
34 33
35 if (controller->IsScreenLocked() || 34 if (controller->IsScreenLocked() ||
36 controller->GetSessionState() != session_manager::SessionState::ACTIVE) { 35 controller->GetSessionState() != session_manager::SessionState::ACTIVE) {
37 return false; 36 return false;
38 } 37 }
39 38
40 // Find the active window (from the primary screen) to un-fullscreen. 39 // Find the active window (from the primary screen) to un-fullscreen.
41 WmWindow* window = WmWindow::Get(GetActiveWindow()); 40 aura::Window* window = GetActiveWindow();
42 if (!window) 41 if (!window)
43 return false; 42 return false;
44 43
45 WindowState* window_state = window->GetWindowState(); 44 WindowState* window_state = GetWindowState(window);
46 if (!window_state->IsFullscreen() || window_state->in_immersive_fullscreen()) 45 if (!window_state->IsFullscreen() || window_state->in_immersive_fullscreen())
47 return false; 46 return false;
48 47
49 // Test that the touch happened in the top or bottom lines. 48 // Test that the touch happened in the top or bottom lines.
50 int y = event.y(); 49 int y = event.y();
51 if (y >= kLeaveFullScreenAreaHeightInPixel && 50 if (y >= kLeaveFullScreenAreaHeightInPixel &&
52 y < (window->GetBounds().height() - kLeaveFullScreenAreaHeightInPixel)) { 51 y < (window->bounds().height() - kLeaveFullScreenAreaHeightInPixel)) {
53 return false; 52 return false;
54 } 53 }
55 54
56 // Do not exit fullscreen in kiosk mode. 55 // Do not exit fullscreen in kiosk mode.
57 if (Shell::Get()->session_controller()->IsKioskSession()) 56 if (Shell::Get()->session_controller()->IsKioskSession())
58 return false; 57 return false;
59 58
60 WMEvent toggle_fullscreen(WM_EVENT_TOGGLE_FULLSCREEN); 59 WMEvent toggle_fullscreen(WM_EVENT_TOGGLE_FULLSCREEN);
61 window->GetWindowState()->OnWMEvent(&toggle_fullscreen); 60 GetWindowState(window)->OnWMEvent(&toggle_fullscreen);
62 return true; 61 return true;
63 } 62 }
64 63
65 } // namespace wm 64 } // namespace wm
66 } // namespace ash 65 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager_unittest.cc ('k') | ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698