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