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