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