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