Commit f877d2bf authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Fold ash::ShellPortMus into ShellPortMash

We removed ash::Config::MUS as part of the switch to //services/ui/ws2.
ShellPortMus isn't used independently anymore.

Bug: 841941
Test: ash_unittests --enable-features=Mash
Change-Id: I506a0526aebd8b90f07d654ceaad8f90891106cb
Reviewed-on: https://chromium-review.googlesource.com/1072454
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562016}
parent bc93c957
...@@ -530,8 +530,6 @@ component("ash") { ...@@ -530,8 +530,6 @@ component("ash") {
"shell_port_classic.h", "shell_port_classic.h",
"shell_port_mash.cc", "shell_port_mash.cc",
"shell_port_mash.h", "shell_port_mash.h",
"shell_port_mus.cc",
"shell_port_mus.h",
"shell_state.cc", "shell_state.cc",
"shell_state.h", "shell_state.h",
"shutdown_controller.cc", "shutdown_controller.cc",
......
...@@ -132,11 +132,9 @@ specific_include_rules = { ...@@ -132,11 +132,9 @@ specific_include_rules = {
"+ash/host/ash_window_tree_host_init_params.h", "+ash/host/ash_window_tree_host_init_params.h",
"+ui/ozone/public" "+ui/ozone/public"
], ],
"shell_port_mus\.cc": [ "shell_port_mash\.cc": [
"+ash/host/ash_window_tree_host_init_params.h", "+ash/host/ash_window_tree_host_init_params.h",
"+ash/host/ash_window_tree_host_mus.h", "+ash/host/ash_window_tree_host_mus.h",
"+ash/host/ash_window_tree_host_mus_mirroring_unified.h",
"+ash/host/ash_window_tree_host_mus_unified.h",
], ],
"window_manager.cc": [ "window_manager.cc": [
"+ash/host/ash_window_tree_host.h" "+ash/host/ash_window_tree_host.h"
......
...@@ -15,6 +15,7 @@ class AshWindowTreeHostMirroringDelegate; ...@@ -15,6 +15,7 @@ class AshWindowTreeHostMirroringDelegate;
// A WTH for the displays mirroring the unified desktop in mus without viz. // A WTH for the displays mirroring the unified desktop in mus without viz.
// This is a near copy of AshWindowTreeHostMirroringUnified. // This is a near copy of AshWindowTreeHostMirroringUnified.
// TODO(crbug.com/841941): Unused. Remove.
class AshWindowTreeHostMusMirroringUnified : public AshWindowTreeHostMus { class AshWindowTreeHostMusMirroringUnified : public AshWindowTreeHostMus {
public: public:
AshWindowTreeHostMusMirroringUnified( AshWindowTreeHostMusMirroringUnified(
......
...@@ -18,6 +18,7 @@ class AshWindowTreeHostMirroringDelegate; ...@@ -18,6 +18,7 @@ class AshWindowTreeHostMirroringDelegate;
// A WTH for the unified desktop display in mus without viz. // A WTH for the unified desktop display in mus without viz.
// This is a near copy of AshWindowTreeHostUnified. // This is a near copy of AshWindowTreeHostUnified.
// TODO(crbug.com/841941): Unused. Remove.
class AshWindowTreeHostMusUnified : public AshWindowTreeHostMus, class AshWindowTreeHostMusUnified : public AshWindowTreeHostMus,
public aura::WindowObserver { public aura::WindowObserver {
public: public:
......
...@@ -9,19 +9,32 @@ ...@@ -9,19 +9,32 @@
#include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_controller.h"
#include "ash/accelerators/accelerator_controller_registrar.h" #include "ash/accelerators/accelerator_controller_registrar.h"
#include "ash/display/display_synchronizer.h"
#include "ash/host/ash_window_tree_host_init_params.h"
#include "ash/host/ash_window_tree_host_mus.h"
#include "ash/keyboard/keyboard_ui_mash.h" #include "ash/keyboard/keyboard_ui_mash.h"
#include "ash/public/cpp/config.h" #include "ash/public/cpp/config.h"
#include "ash/public/cpp/immersive/immersive_fullscreen_controller.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/touch/touch_transform_setter_mus.h"
#include "ash/window_manager.h" #include "ash/window_manager.h"
#include "ash/wm/drag_window_resizer_mash.h" #include "ash/wm/drag_window_resizer_mash.h"
#include "ash/wm/immersive_handler_factory_mash.h" #include "ash/wm/immersive_handler_factory_mash.h"
#include "ash/wm/tablet_mode/tablet_mode_event_handler.h" #include "ash/wm/tablet_mode/tablet_mode_event_handler.h"
#include "ash/wm/window_cycle_event_filter.h" #include "ash/wm/window_cycle_event_filter.h"
#include "ash/wm/window_resizer.h" #include "ash/wm/window_resizer.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/workspace_event_handler_mash.h" #include "ash/wm/workspace/workspace_event_handler_mash.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/public/interfaces/video_detector.mojom.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/mus/window_tree_host_mus_init_params.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/display.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/manager/forwarding_display_delegate.h"
#include "ui/display/mojo/native_display_delegate.mojom.h"
#include "ui/views/mus/pointer_watcher_event_router.h" #include "ui/views/mus/pointer_watcher_event_router.h"
namespace ash { namespace ash {
...@@ -29,10 +42,11 @@ namespace ash { ...@@ -29,10 +42,11 @@ namespace ash {
ShellPortMash::ShellPortMash( ShellPortMash::ShellPortMash(
WindowManager* window_manager, WindowManager* window_manager,
views::PointerWatcherEventRouter* pointer_watcher_event_router) views::PointerWatcherEventRouter* pointer_watcher_event_router)
: ShellPortMus(window_manager), : window_manager_(window_manager),
pointer_watcher_event_router_(pointer_watcher_event_router), pointer_watcher_event_router_(pointer_watcher_event_router),
immersive_handler_factory_( immersive_handler_factory_(
std::make_unique<ImmersiveHandlerFactoryMash>()) { std::make_unique<ImmersiveHandlerFactoryMash>()) {
DCHECK(window_manager_);
DCHECK(pointer_watcher_event_router_); DCHECK(pointer_watcher_event_router_);
DCHECK_EQ(Config::MASH, GetAshConfig()); DCHECK_EQ(Config::MASH, GetAshConfig());
} }
...@@ -46,10 +60,21 @@ ShellPortMash* ShellPortMash::Get() { ...@@ -46,10 +60,21 @@ ShellPortMash* ShellPortMash::Get() {
return static_cast<ShellPortMash*>(ShellPort::Get()); return static_cast<ShellPortMash*>(ShellPort::Get());
} }
void ShellPortMash::Shutdown() {
display_synchronizer_.reset();
ShellPort::Shutdown();
}
Config ShellPortMash::GetAshConfig() const { Config ShellPortMash::GetAshConfig() const {
return Config::MASH; return Config::MASH;
} }
std::unique_ptr<display::TouchTransformSetter>
ShellPortMash::CreateTouchTransformDelegate() {
return std::make_unique<TouchTransformSetterMus>(
window_manager_->connector());
}
void ShellPortMash::LockCursor() { void ShellPortMash::LockCursor() {
// When we are running in mus, we need to keep track of state not just in the // When we are running in mus, we need to keep track of state not just in the
// window server, but also locally in ash because ash treats the cursor // window server, but also locally in ash because ash treats the cursor
...@@ -144,11 +169,81 @@ void ShellPortMash::ToggleIgnoreExternalKeyboard() { ...@@ -144,11 +169,81 @@ void ShellPortMash::ToggleIgnoreExternalKeyboard() {
} }
void ShellPortMash::CreatePointerWatcherAdapter() { void ShellPortMash::CreatePointerWatcherAdapter() {
// In Config::MUS PointerWatcherAdapterClassic must be created when this // In Config::CLASSIC PointerWatcherAdapterClassic must be created when this
// function is called (it is order dependent), that is not the case with // function is called (it is order dependent), that is not the case with
// Config::MASH. // Config::MASH.
} }
std::unique_ptr<AshWindowTreeHost> ShellPortMash::CreateAshWindowTreeHost(
const AshWindowTreeHostInitParams& init_params) {
auto display_params = std::make_unique<aura::DisplayInitParams>();
display_params->viewport_metrics.bounds_in_pixels =
init_params.initial_bounds;
display_params->viewport_metrics.device_scale_factor =
init_params.device_scale_factor;
display_params->viewport_metrics.ui_scale_factor =
init_params.ui_scale_factor;
display::DisplayManager* display_manager = Shell::Get()->display_manager();
display::Display mirrored_display =
display_manager->GetMirroringDisplayById(init_params.display_id);
if (mirrored_display.is_valid()) {
display_params->display =
std::make_unique<display::Display>(mirrored_display);
}
display_params->is_primary_display = true;
display_params->mirrors = display_manager->software_mirroring_display_list();
aura::WindowTreeHostMusInitParams aura_init_params =
window_manager_->window_manager_client()->CreateInitParamsForNewDisplay();
aura_init_params.display_id = init_params.display_id;
aura_init_params.display_init_params = std::move(display_params);
aura_init_params.use_classic_ime = !Shell::ShouldUseIMEService();
return std::make_unique<AshWindowTreeHostMus>(std::move(aura_init_params));
}
void ShellPortMash::OnCreatedRootWindowContainers(
RootWindowController* root_window_controller) {
// TODO: To avoid lots of IPC AddActivationParent() should take an array.
// http://crbug.com/682048.
aura::Window* root_window = root_window_controller->GetRootWindow();
for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) {
window_manager_->window_manager_client()->AddActivationParent(
root_window->GetChildById(kActivatableShellWindowIds[i]));
}
UpdateSystemModalAndBlockingContainers();
}
void ShellPortMash::UpdateSystemModalAndBlockingContainers() {
std::vector<aura::BlockingContainers> all_blocking_containers;
for (RootWindowController* root_window_controller :
Shell::GetAllRootWindowControllers()) {
aura::BlockingContainers blocking_containers;
wm::GetBlockingContainersForRoot(
root_window_controller->GetRootWindow(),
&blocking_containers.min_container,
&blocking_containers.system_modal_container);
all_blocking_containers.push_back(blocking_containers);
}
window_manager_->window_manager_client()->SetBlockingContainers(
all_blocking_containers);
}
void ShellPortMash::OnHostsInitialized() {
display_synchronizer_ = std::make_unique<DisplaySynchronizer>(
window_manager_->window_manager_client());
}
std::unique_ptr<display::NativeDisplayDelegate>
ShellPortMash::CreateNativeDisplayDelegate() {
display::mojom::NativeDisplayDelegatePtr native_display_delegate;
if (window_manager_->connector()) {
window_manager_->connector()->BindInterface(ui::mojom::kServiceName,
&native_display_delegate);
}
return std::make_unique<display::ForwardingDisplayDelegate>(
std::move(native_display_delegate));
}
std::unique_ptr<AcceleratorController> std::unique_ptr<AcceleratorController>
ShellPortMash::CreateAcceleratorController() { ShellPortMash::CreateAcceleratorController() {
uint16_t accelerator_namespace_id = 0u; uint16_t accelerator_namespace_id = 0u;
...@@ -165,4 +260,16 @@ ShellPortMash::CreateAcceleratorController() { ...@@ -165,4 +260,16 @@ ShellPortMash::CreateAcceleratorController() {
accelerator_controller_registrar_.get()); accelerator_controller_registrar_.get());
} }
void ShellPortMash::AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) {
// We may not have access to the connector in unit tests.
if (!window_manager_->connector())
return;
ui::mojom::VideoDetectorPtr video_detector;
window_manager_->connector()->BindInterface(ui::mojom::kServiceName,
&video_detector);
video_detector->AddObserver(std::move(observer));
}
} // namespace ash } // namespace ash
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "ash/shell_port_mus.h" #include "ash/shell_port.h"
#include "base/macros.h" #include "base/macros.h"
namespace views { namespace views {
...@@ -20,13 +20,12 @@ class PointerWatcherEventRouter; ...@@ -20,13 +20,12 @@ class PointerWatcherEventRouter;
namespace ash { namespace ash {
class AcceleratorControllerRegistrar; class AcceleratorControllerRegistrar;
class DisplaySynchronizer;
class ImmersiveHandlerFactoryMash; class ImmersiveHandlerFactoryMash;
class WindowManager; class WindowManager;
// ShellPort implementation for mash. See ash/README.md for more. Subclass of // ShellPort implementation for mash. See ash/README.md for more.
// ShellPortMus because both configurations talk to the same UI service for class ShellPortMash : public ShellPort {
// things like display management.
class ShellPortMash : public ShellPortMus {
public: public:
ShellPortMash(WindowManager* window_manager, ShellPortMash(WindowManager* window_manager,
views::PointerWatcherEventRouter* pointer_watcher_event_router); views::PointerWatcherEventRouter* pointer_watcher_event_router);
...@@ -38,7 +37,10 @@ class ShellPortMash : public ShellPortMus { ...@@ -38,7 +37,10 @@ class ShellPortMash : public ShellPortMus {
void OnCursorTouchVisibleChanged(bool enabled); void OnCursorTouchVisibleChanged(bool enabled);
// ShellPort: // ShellPort:
void Shutdown() override;
Config GetAshConfig() const override; Config GetAshConfig() const override;
std::unique_ptr<display::TouchTransformSetter> CreateTouchTransformDelegate()
override;
void LockCursor() override; void LockCursor() override;
void UnlockCursor() override; void UnlockCursor() override;
void ShowCursor() override; void ShowCursor() override;
...@@ -63,9 +65,21 @@ class ShellPortMash : public ShellPortMus { ...@@ -63,9 +65,21 @@ class ShellPortMash : public ShellPortMus {
bool IsTouchDown() override; bool IsTouchDown() override;
void ToggleIgnoreExternalKeyboard() override; void ToggleIgnoreExternalKeyboard() override;
void CreatePointerWatcherAdapter() override; void CreatePointerWatcherAdapter() override;
std::unique_ptr<AshWindowTreeHost> CreateAshWindowTreeHost(
const AshWindowTreeHostInitParams& init_params) override;
void OnCreatedRootWindowContainers(
RootWindowController* root_window_controller) override;
void UpdateSystemModalAndBlockingContainers() override;
void OnHostsInitialized() override;
std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
override;
std::unique_ptr<AcceleratorController> CreateAcceleratorController() override; std::unique_ptr<AcceleratorController> CreateAcceleratorController() override;
void AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) override;
private: private:
WindowManager* window_manager_;
std::unique_ptr<DisplaySynchronizer> display_synchronizer_;
views::PointerWatcherEventRouter* pointer_watcher_event_router_ = nullptr; views::PointerWatcherEventRouter* pointer_watcher_event_router_ = nullptr;
std::unique_ptr<AcceleratorControllerRegistrar> std::unique_ptr<AcceleratorControllerRegistrar>
accelerator_controller_registrar_; accelerator_controller_registrar_;
......
This diff is collapsed.
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SHELL_PORT_MUS_H_
#define ASH_SHELL_PORT_MUS_H_
#include <stdint.h>
#include <memory>
#include "ash/shell_port.h"
#include "base/macros.h"
namespace aura {
class WindowTreeClient;
}
namespace ash {
class DisplaySynchronizer;
class PointerWatcherAdapterClassic;
class RootWindowController;
class WindowManager;
// ShellPort implementation for mus (and parts of mash). See ash/README.md.
// Often uses "classic" ash implementations because only the window server
// pieces are in a different mojo service.
// TODO(crbug.com/841941): Fold into ShellPortMash. Config::MUS is deprecated.
class ShellPortMus : public ShellPort {
public:
explicit ShellPortMus(WindowManager* window_manager);
~ShellPortMus() override;
static ShellPortMus* Get();
ash::RootWindowController* GetRootWindowControllerWithDisplayId(int64_t id);
aura::WindowTreeClient* window_tree_client();
WindowManager* window_manager() { return window_manager_; }
// ShellPort:
void Shutdown() override;
Config GetAshConfig() const override;
std::unique_ptr<display::TouchTransformSetter> CreateTouchTransformDelegate()
override;
void LockCursor() override;
void UnlockCursor() override;
void ShowCursor() override;
void HideCursor() override;
void SetCursorSize(ui::CursorSize cursor_size) override;
void SetGlobalOverrideCursor(base::Optional<ui::CursorData> cursor) override;
bool IsMouseEventsEnabled() override;
void SetCursorTouchVisible(bool enabled) override;
std::unique_ptr<WindowResizer> CreateDragWindowResizer(
std::unique_ptr<WindowResizer> next_window_resizer,
wm::WindowState* window_state) override;
std::unique_ptr<WindowCycleEventFilter> CreateWindowCycleEventFilter()
override;
std::unique_ptr<wm::TabletModeEventHandler> CreateTabletModeEventHandler()
override;
std::unique_ptr<WorkspaceEventHandler> CreateWorkspaceEventHandler(
aura::Window* workspace_window) override;
std::unique_ptr<KeyboardUI> CreateKeyboardUI() override;
void AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) override;
void RemovePointerWatcher(views::PointerWatcher* watcher) override;
bool IsTouchDown() override;
void ToggleIgnoreExternalKeyboard() override;
void CreatePointerWatcherAdapter() override;
std::unique_ptr<AshWindowTreeHost> CreateAshWindowTreeHost(
const AshWindowTreeHostInitParams& init_params) override;
void OnCreatedRootWindowContainers(
RootWindowController* root_window_controller) override;
void UpdateSystemModalAndBlockingContainers() override;
void OnHostsInitialized() override;
std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
override;
std::unique_ptr<AcceleratorController> CreateAcceleratorController() override;
void AddVideoDetectorObserver(
viz::mojom::VideoDetectorObserverPtr observer) override;
protected:
WindowManager* window_manager_;
private:
std::unique_ptr<PointerWatcherAdapterClassic> pointer_watcher_adapter_;
std::unique_ptr<DisplaySynchronizer> display_synchronizer_;
DISALLOW_COPY_AND_ASSIGN(ShellPortMus);
};
} // namespace ash
#endif // ASH_SHELL_PORT_MUS_H_
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "ash/shell_port.h" #include "ash/shell_port.h"
#include "ash/shell_port_classic.h" #include "ash/shell_port_classic.h"
#include "ash/shell_port_mash.h" #include "ash/shell_port_mash.h"
#include "ash/shell_port_mus.h"
#include "ash/system/screen_layout_observer.h" #include "ash/system/screen_layout_observer.h"
#include "ash/test/ash_test_environment.h" #include "ash/test/ash_test_environment.h"
#include "ash/test/ash_test_views_delegate.h" #include "ash/test/ash_test_views_delegate.h"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "ash/shell_delegate_mus.h" #include "ash/shell_delegate_mus.h"
#include "ash/shell_init_params.h" #include "ash/shell_init_params.h"
#include "ash/shell_port_mash.h" #include "ash/shell_port_mash.h"
#include "ash/shell_port_mus.h"
#include "ash/wm/ash_focus_rules.h" #include "ash/wm/ash_focus_rules.h"
#include "ash/wm/move_event_handler.h" #include "ash/wm/move_event_handler.h"
#include "ash/wm/non_client_frame_controller.h" #include "ash/wm/non_client_frame_controller.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment