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