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