| 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 "chrome/browser/ui/views/frame/immersive_context_mus.h" | 5 #include "chrome/browser/ui/views/frame/immersive_context_mus.h" |
| 6 | 6 |
| 7 #include "services/ui/public/cpp/window_tree_client.h" | 7 #include "ui/aura/client/capture_client.h" |
| 8 #include "ui/views/mus/pointer_watcher_event_router.h" | 8 #include "ui/views/mus/mus_client.h" |
| 9 #include "ui/views/mus/window_manager_connection.h" | 9 #include "ui/views/mus/pointer_watcher_event_router2.h" |
| 10 #include "ui/views/pointer_watcher.h" | 10 #include "ui/views/pointer_watcher.h" |
| 11 | 11 |
| 12 ImmersiveContextMus::ImmersiveContextMus() {} | 12 ImmersiveContextMus::ImmersiveContextMus( |
| 13 aura::client::CaptureClient* capture_client) |
| 14 : capture_client_(capture_client) {} |
| 13 | 15 |
| 14 ImmersiveContextMus::~ImmersiveContextMus() {} | 16 ImmersiveContextMus::~ImmersiveContextMus() {} |
| 15 | 17 |
| 16 void ImmersiveContextMus::InstallResizeHandleWindowTargeter( | 18 void ImmersiveContextMus::InstallResizeHandleWindowTargeter( |
| 17 ash::ImmersiveFullscreenController* controller) { | 19 ash::ImmersiveFullscreenController* controller) { |
| 18 // There shouldn't be a need to do anything here, the windowmanager takes care | 20 // There shouldn't be a need to do anything here, the windowmanager takes care |
| 19 // of this for us. | 21 // of this for us. |
| 20 } | 22 } |
| 21 | 23 |
| 22 void ImmersiveContextMus::OnEnteringOrExitingImmersive( | 24 void ImmersiveContextMus::OnEnteringOrExitingImmersive( |
| 23 ash::ImmersiveFullscreenController* controller, | 25 ash::ImmersiveFullscreenController* controller, |
| 24 bool entering) { | 26 bool entering) { |
| 25 // TODO: see implementation in ImmersiveContextAsh, this needs to use mojo | 27 // TODO: see implementation in ImmersiveContextAsh, this needs to use mojo |
| 26 // to poke some state in mash (shelf model, in immersive, shelf | 28 // to poke some state in mash (shelf model, in immersive, shelf |
| 27 // visibility...). | 29 // visibility...). |
| 28 // http://crbug.com/640371. | 30 // http://crbug.com/640371. |
| 29 NOTIMPLEMENTED(); | 31 NOTIMPLEMENTED(); |
| 30 } | 32 } |
| 31 | 33 |
| 32 gfx::Rect ImmersiveContextMus::GetDisplayBoundsInScreen(views::Widget* widget) { | 34 gfx::Rect ImmersiveContextMus::GetDisplayBoundsInScreen(views::Widget* widget) { |
| 33 return widget->GetWindowBoundsInScreen(); | 35 return widget->GetWindowBoundsInScreen(); |
| 34 } | 36 } |
| 35 | 37 |
| 36 void ImmersiveContextMus::AddPointerWatcher( | 38 void ImmersiveContextMus::AddPointerWatcher( |
| 37 views::PointerWatcher* watcher, | 39 views::PointerWatcher* watcher, |
| 38 views::PointerWatcherEventTypes events) { | 40 views::PointerWatcherEventTypes events) { |
| 39 // TODO: http://crbug.com/641164 | 41 // TODO: http://crbug.com/641164 |
| 40 views::WindowManagerConnection::Get() | 42 views::MusClient::Get()->pointer_watcher_event_router()->AddPointerWatcher( |
| 41 ->pointer_watcher_event_router() | 43 watcher, events == views::PointerWatcherEventTypes::MOVES); |
| 42 ->AddPointerWatcher(watcher, | |
| 43 events == views::PointerWatcherEventTypes::MOVES); | |
| 44 } | 44 } |
| 45 | 45 |
| 46 void ImmersiveContextMus::RemovePointerWatcher(views::PointerWatcher* watcher) { | 46 void ImmersiveContextMus::RemovePointerWatcher(views::PointerWatcher* watcher) { |
| 47 views::WindowManagerConnection::Get() | 47 views::MusClient::Get()->pointer_watcher_event_router()->RemovePointerWatcher( |
| 48 ->pointer_watcher_event_router() | 48 watcher); |
| 49 ->RemovePointerWatcher(watcher); | |
| 50 } | 49 } |
| 51 | 50 |
| 52 bool ImmersiveContextMus::DoesAnyWindowHaveCapture() { | 51 bool ImmersiveContextMus::DoesAnyWindowHaveCapture() { |
| 53 return views::WindowManagerConnection::Get()->client()->GetCaptureWindow() != | 52 return capture_client_->GetGlobalCaptureWindow() != nullptr; |
| 54 nullptr; | |
| 55 } | 53 } |
| 56 | 54 |
| 57 bool ImmersiveContextMus::IsMouseEventsEnabled() { | 55 bool ImmersiveContextMus::IsMouseEventsEnabled() { |
| 58 // TODO: http://crbug.com/640374. | 56 // TODO: http://crbug.com/640374. |
| 59 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
| 60 return true; | 58 return true; |
| 61 } | 59 } |
| OLD | NEW |