OLD | NEW |
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/immersive_context_ash.h" | 5 #include "ash/wm/immersive_context_ash.h" |
6 | 6 |
7 #include "ash/shared/immersive_fullscreen_controller.h" | 7 #include "ash/shared/immersive_fullscreen_controller.h" |
8 #include "ash/shelf/wm_shelf.h" | 8 #include "ash/shelf/wm_shelf.h" |
| 9 #include "ash/shell_port.h" |
9 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
11 #include "ash/wm_shell.h" | |
12 #include "ash/wm_window.h" | 12 #include "ash/wm_window.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
15 #include "ui/display/screen.h" | 15 #include "ui/display/screen.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 | 19 |
20 ImmersiveContextAsh::ImmersiveContextAsh() {} | 20 ImmersiveContextAsh::ImmersiveContextAsh() {} |
21 | 21 |
22 ImmersiveContextAsh::~ImmersiveContextAsh() {} | 22 ImmersiveContextAsh::~ImmersiveContextAsh() {} |
23 | 23 |
24 void ImmersiveContextAsh::InstallResizeHandleWindowTargeter( | 24 void ImmersiveContextAsh::InstallResizeHandleWindowTargeter( |
25 ImmersiveFullscreenController* controller) { | 25 ImmersiveFullscreenController* controller) { |
26 WmWindow* window = WmWindow::Get(controller->widget()->GetNativeWindow()); | 26 WmWindow* window = WmWindow::Get(controller->widget()->GetNativeWindow()); |
27 window->InstallResizeHandleWindowTargeter(controller); | 27 window->InstallResizeHandleWindowTargeter(controller); |
28 } | 28 } |
29 | 29 |
30 void ImmersiveContextAsh::OnEnteringOrExitingImmersive( | 30 void ImmersiveContextAsh::OnEnteringOrExitingImmersive( |
31 ImmersiveFullscreenController* controller, | 31 ImmersiveFullscreenController* controller, |
32 bool entering) { | 32 bool entering) { |
33 WmWindow* window = WmWindow::Get(controller->widget()->GetNativeWindow()); | 33 WmWindow* window = WmWindow::Get(controller->widget()->GetNativeWindow()); |
34 wm::WindowState* window_state = window->GetWindowState(); | 34 wm::WindowState* window_state = window->GetWindowState(); |
35 // Auto hide the shelf in immersive fullscreen instead of hiding it. | 35 // Auto hide the shelf in immersive fullscreen instead of hiding it. |
36 window_state->set_hide_shelf_when_fullscreen(!entering); | 36 window_state->set_hide_shelf_when_fullscreen(!entering); |
37 // Update the window's immersive mode state for the window manager. | 37 // Update the window's immersive mode state for the window manager. |
38 window_state->set_in_immersive_fullscreen(entering); | 38 window_state->set_in_immersive_fullscreen(entering); |
39 | 39 |
40 for (WmWindow* root_window : WmShell::Get()->GetAllRootWindows()) | 40 for (WmWindow* root_window : ShellPort::Get()->GetAllRootWindows()) |
41 WmShelf::ForWindow(root_window)->UpdateVisibilityState(); | 41 WmShelf::ForWindow(root_window)->UpdateVisibilityState(); |
42 } | 42 } |
43 | 43 |
44 gfx::Rect ImmersiveContextAsh::GetDisplayBoundsInScreen(views::Widget* widget) { | 44 gfx::Rect ImmersiveContextAsh::GetDisplayBoundsInScreen(views::Widget* widget) { |
45 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); | 45 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); |
46 return window->GetDisplayNearestWindow().bounds(); | 46 return window->GetDisplayNearestWindow().bounds(); |
47 } | 47 } |
48 | 48 |
49 void ImmersiveContextAsh::AddPointerWatcher( | 49 void ImmersiveContextAsh::AddPointerWatcher( |
50 views::PointerWatcher* watcher, | 50 views::PointerWatcher* watcher, |
51 views::PointerWatcherEventTypes events) { | 51 views::PointerWatcherEventTypes events) { |
52 WmShell::Get()->AddPointerWatcher(watcher, events); | 52 ShellPort::Get()->AddPointerWatcher(watcher, events); |
53 } | 53 } |
54 | 54 |
55 void ImmersiveContextAsh::RemovePointerWatcher(views::PointerWatcher* watcher) { | 55 void ImmersiveContextAsh::RemovePointerWatcher(views::PointerWatcher* watcher) { |
56 WmShell::Get()->RemovePointerWatcher(watcher); | 56 ShellPort::Get()->RemovePointerWatcher(watcher); |
57 } | 57 } |
58 | 58 |
59 bool ImmersiveContextAsh::DoesAnyWindowHaveCapture() { | 59 bool ImmersiveContextAsh::DoesAnyWindowHaveCapture() { |
60 return wm::GetCaptureWindow() != nullptr; | 60 return wm::GetCaptureWindow() != nullptr; |
61 } | 61 } |
62 | 62 |
63 bool ImmersiveContextAsh::IsMouseEventsEnabled() { | 63 bool ImmersiveContextAsh::IsMouseEventsEnabled() { |
64 return WmShell::Get()->IsMouseEventsEnabled(); | 64 return ShellPort::Get()->IsMouseEventsEnabled(); |
65 } | 65 } |
66 | 66 |
67 } // namespace ash | 67 } // namespace ash |
OLD | NEW |