Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1915)

Unified Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2783563002: Make WmShellMus use classic types for mus (Closed)
Patch Set: fix x11 build Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/mus/bridge/wm_shell_mus.cc
diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc
index f9d2445a5756ac294bd67fa96cae161312de29f0..51c52860d38d206a0d36d8ee6583a32afbfc8c6e 100644
--- a/ash/mus/bridge/wm_shell_mus.cc
+++ b/ash/mus/bridge/wm_shell_mus.cc
@@ -7,6 +7,8 @@
#include <utility>
#include "ash/accelerators/accelerator_controller_delegate_aura.h"
+#include "ash/aura/key_event_watcher_aura.h"
+#include "ash/aura/pointer_watcher_adapter.h"
#include "ash/common/accelerators/accelerator_controller.h"
#include "ash/common/key_event_watcher.h"
#include "ash/common/session/session_state_delegate.h"
@@ -20,6 +22,8 @@
#include "ash/common/wm/window_cycle_event_filter.h"
#include "ash/common/wm/window_resizer.h"
#include "ash/common/wm_window.h"
+#include "ash/laser/laser_pointer_controller.h"
+#include "ash/magnifier/partial_magnification_controller.h"
#include "ash/mus/accelerators/accelerator_controller_delegate_mus.h"
#include "ash/mus/accelerators/accelerator_controller_registrar.h"
#include "ash/mus/bridge/immersive_handler_factory_mus.h"
@@ -34,9 +38,17 @@
#include "ash/shared/immersive_fullscreen_controller.h"
#include "ash/shell.h"
#include "ash/shell_init_params.h"
+#include "ash/touch/touch_uma.h"
+#include "ash/virtual_keyboard_controller.h"
+#include "ash/wm/drag_window_resizer.h"
+#include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h"
+#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h"
+#include "ash/wm/window_cycle_event_filter_aura.h"
#include "ash/wm/window_util.h"
+#include "ash/wm/workspace/workspace_event_handler_aura.h"
#include "base/memory/ptr_util.h"
#include "components/user_manager/user_info_impl.h"
+#include "ui/aura/env.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
@@ -123,6 +135,8 @@ aura::WindowTreeClient* WmShellMus::window_tree_client() {
}
void WmShellMus::Shutdown() {
+ pointer_watcher_adapter_.reset();
+
WmShell::Shutdown();
window_manager_->DeleteAllRootWindowControllers();
@@ -241,16 +255,31 @@ std::vector<WmWindow*> WmShellMus::GetAllRootWindows() {
}
void WmShellMus::RecordGestureAction(GestureActionType action) {
+ if (GetConfig() == Config::MUS) {
+ TouchUMA::GetInstance()->RecordGestureAction(action);
+ return;
+ }
// TODO: http://crbug.com/616581.
NOTIMPLEMENTED();
}
void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) {
+ if (GetConfig() == Config::MUS) {
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction(action);
msw 2017/03/28 20:26:32 Can MASH use this too, since it now instantiates a
sky 2017/03/28 21:21:01 Shell only creates UserMetricsRecorder in classic
+ return;
+ }
// TODO: http://crbug.com/616581.
NOTIMPLEMENTED();
}
void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) {
+ if (GetConfig() == Config::MUS) {
+ Shell::GetInstance()
+ ->metrics()
+ ->task_switch_metrics_recorder()
+ .OnTaskSwitch(source);
+ return;
+ }
// TODO: http://crbug.com/616581.
NOTIMPLEMENTED();
}
@@ -258,18 +287,28 @@ void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) {
std::unique_ptr<WindowResizer> WmShellMus::CreateDragWindowResizer(
std::unique_ptr<WindowResizer> next_window_resizer,
wm::WindowState* window_state) {
- return base::MakeUnique<DragWindowResizer>(std::move(next_window_resizer),
- window_state);
+ if (GetConfig() == Config::MUS) {
+ return base::WrapUnique(ash::DragWindowResizer::Create(
+ next_window_resizer.release(), window_state));
+ }
+ return base::MakeUnique<ash::mus::DragWindowResizer>(
+ std::move(next_window_resizer), window_state);
}
std::unique_ptr<WindowCycleEventFilter>
WmShellMus::CreateWindowCycleEventFilter() {
+ if (GetConfig() == Config::MUS)
+ return base::MakeUnique<WindowCycleEventFilterAura>();
+
// TODO: implement me, http://crbug.com/629191.
return nullptr;
}
std::unique_ptr<wm::MaximizeModeEventHandler>
WmShellMus::CreateMaximizeModeEventHandler() {
+ if (GetConfig() == Config::MUS)
+ return base::MakeUnique<wm::MaximizeModeEventHandlerAura>();
+
// TODO: need support for window manager to get events before client:
// http://crbug.com/624157.
NOTIMPLEMENTED();
@@ -278,6 +317,17 @@ WmShellMus::CreateMaximizeModeEventHandler() {
std::unique_ptr<ScopedDisableInternalMouseAndKeyboard>
WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() {
+ if (GetConfig() == Config::MUS) {
+#if defined(USE_OZONE)
+ return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>();
+#else
+ // TODO: remove this conditional. Bots build this config, but it is never
+ // actually used.
msw 2017/03/28 20:26:32 optional nit: cite a bug or actually create a Scop
sky 2017/03/28 21:21:01 x11 for chromeos isn't actually used anymore outsi
+ NOTREACHED();
+ return nullptr;
+#endif
+ }
+
// TODO: needs implementation for mus, http://crbug.com/624967.
NOTIMPLEMENTED();
return nullptr;
@@ -285,6 +335,9 @@ WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() {
std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler(
WmWindow* workspace_window) {
+ if (GetConfig() == Config::MUS)
+ return base::MakeUnique<WorkspaceEventHandlerAura>(workspace_window);
+
return base::MakeUnique<WorkspaceEventHandlerMus>(
WmWindow::GetAuraWindow(workspace_window));
}
@@ -295,10 +348,16 @@ WmShellMus::CreateImmersiveFullscreenController() {
}
std::unique_ptr<KeyboardUI> WmShellMus::CreateKeyboardUI() {
+ if (GetConfig() == Config::MUS)
+ return KeyboardUI::Create();
+
return KeyboardUIMus::Create(window_manager_->connector());
}
std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() {
+ if (GetConfig() == Config::MUS)
+ return base::MakeUnique<KeyEventWatcherAura>();
+
// TODO: needs implementation for mus, http://crbug.com/649600.
NOTIMPLEMENTED();
return std::unique_ptr<KeyEventWatcher>();
@@ -311,15 +370,22 @@ SessionStateDelegate* WmShellMus::GetSessionStateDelegate() {
}
void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) {
+ // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
NOTIMPLEMENTED();
}
void WmShellMus::RemoveDisplayObserver(WmDisplayObserver* observer) {
+ // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
NOTIMPLEMENTED();
}
void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher,
views::PointerWatcherEventTypes events) {
+ if (GetConfig() == Config::MUS) {
+ pointer_watcher_adapter_->AddPointerWatcher(watcher, events);
+ return;
+ }
+
// TODO: implement drags for mus pointer watcher, http://crbug.com/641164.
// NOTIMPLEMENTED drags for mus pointer watcher.
pointer_watcher_event_router_->AddPointerWatcher(
@@ -327,29 +393,58 @@ void WmShellMus::AddPointerWatcher(views::PointerWatcher* watcher,
}
void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) {
+ if (GetConfig() == Config::MUS) {
+ pointer_watcher_adapter_->RemovePointerWatcher(watcher);
+ return;
+ }
+
pointer_watcher_event_router_->RemovePointerWatcher(watcher);
}
bool WmShellMus::IsTouchDown() {
+ if (GetConfig() == Config::MUS)
+ return aura::Env::GetInstance()->is_touch_down();
+
// TODO: implement me, http://crbug.com/634967.
// NOTIMPLEMENTED is too spammy here.
return false;
}
void WmShellMus::ToggleIgnoreExternalKeyboard() {
+ if (GetConfig() == Config::MUS) {
+ Shell::GetInstance()
+ ->virtual_keyboard_controller()
+ ->ToggleIgnoreExternalKeyboard();
+ return;
+ }
+
NOTIMPLEMENTED();
}
void WmShellMus::SetLaserPointerEnabled(bool enabled) {
+ if (GetConfig() == Config::MUS) {
+ Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled);
+ return;
+ }
+
NOTIMPLEMENTED();
}
void WmShellMus::SetPartialMagnifierEnabled(bool enabled) {
+ if (GetConfig() == Config::MUS) {
+ Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
+ enabled);
+ return;
+ }
+
NOTIMPLEMENTED();
}
void WmShellMus::CreatePointerWatcherAdapter() {
- // Only needed in WmShellAura, which has specific creation order.
+ // In Config::MUS PointerWatcherAdapter must be created when this function is
+ // caled (it is order dependent), that is not the case with Config::MASH.
msw 2017/03/28 20:26:32 nit: called
sky 2017/03/28 21:21:01 Done.
+ if (GetConfig() == Config::MUS)
+ pointer_watcher_adapter_ = base::MakeUnique<PointerWatcherAdapter>();
}
void WmShellMus::CreatePrimaryHost() {}

Powered by Google App Engine
This is Rietveld 408576698