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

Unified Diff: ash/shell.cc

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell/content/client/shell_browser_main_parts.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index b9eb01774078d91fb3ec238ce4efd22927f5fd14..e45191092c0a50b5ca9b2a3e2d6b2b3a825538c9 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -10,10 +10,13 @@
#include "ash/accelerators/accelerator_controller_delegate_aura.h"
#include "ash/accelerators/accelerator_delegate.h"
+#include "ash/accelerators/magnifier_key_scroller.h"
+#include "ash/accelerators/spoken_feedback_toggler.h"
#include "ash/aura/wm_shell_aura.h"
#include "ash/aura/wm_window_aura.h"
#include "ash/autoclick/autoclick_controller.h"
#include "ash/common/accelerators/accelerator_controller.h"
+#include "ash/common/ash_constants.h"
#include "ash/common/frame/custom_frame_view_ash.h"
#include "ash/common/gpu_support.h"
#include "ash/common/keyboard/keyboard_ui.h"
@@ -25,6 +28,8 @@
#include "ash/common/shelf/shelf_model.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shell_delegate.h"
+#include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller.h"
+#include "ash/common/system/chromeos/power/power_status.h"
#include "ash/common/system/status_area_widget.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/wallpaper/wallpaper_delegate.h"
@@ -39,11 +44,17 @@
#include "ash/common/wm_root_window_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/display/cursor_window_controller.h"
+#include "ash/display/display_color_manager_chromeos.h"
#include "ash/display/display_configuration_controller.h"
+#include "ash/display/display_error_observer_chromeos.h"
#include "ash/display/event_transformation_handler.h"
#include "ash/display/mouse_cursor_event_filter.h"
+#include "ash/display/projecting_observer_chromeos.h"
+#include "ash/display/resolution_notification_controller.h"
#include "ash/display/screen_ash.h"
+#include "ash/display/screen_orientation_controller_chromeos.h"
#include "ash/display/screen_position_controller.h"
+#include "ash/display/shutdown_observer_chromeos.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/drag_drop/drag_drop_controller.h"
#include "ash/first_run/first_run_helper_impl.h"
@@ -56,8 +67,13 @@
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/shell_init_params.h"
+#include "ash/sticky_keys/sticky_keys_controller.h"
+#include "ash/system/chromeos/power/power_event_observer.h"
+#include "ash/system/chromeos/power/video_activity_notifier.h"
#include "ash/system/chromeos/screen_layout_observer.h"
+#include "ash/touch/touch_transformer_controller.h"
#include "ash/utility/screenshot_controller.h"
+#include "ash/virtual_keyboard_controller.h"
#include "ash/wm/ash_focus_rules.h"
#include "ash/wm/ash_native_cursor_manager.h"
#include "ash/wm/event_client_impl.h"
@@ -76,9 +92,14 @@
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
+#include "base/sys_info.h"
#include "base/trace_event/trace_event.h"
+#include "chromeos/audio/audio_a11y_controller.h"
+#include "chromeos/chromeos_switches.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/layout_manager.h"
@@ -86,9 +107,12 @@
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/ui_base_switches.h"
#include "ui/base/user_activity/user_activity_detector.h"
+#include "ui/chromeos/user_activity_power_manager_notifier.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/display/display.h"
+#include "ui/display/manager/chromeos/display_change_observer.h"
+#include "ui/display/manager/chromeos/display_configurator.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/screen.h"
#include "ui/events/event_target_iterator.h"
@@ -109,44 +133,15 @@
#include "ui/wm/core/visibility_controller.h"
#include "ui/wm/core/window_modality_controller.h"
-#if defined(OS_CHROMEOS)
-#if defined(USE_X11)
-#include "ui/gfx/x/x11_types.h" // nogncheck
-#endif // defined(USE_X11)
-#include "ash/accelerators/magnifier_key_scroller.h"
-#include "ash/accelerators/spoken_feedback_toggler.h"
-#include "ash/common/ash_constants.h"
-#include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller.h"
-#include "ash/common/system/chromeos/power/power_status.h"
-#include "ash/display/display_color_manager_chromeos.h"
-#include "ash/display/display_error_observer_chromeos.h"
-#include "ash/display/projecting_observer_chromeos.h"
-#include "ash/display/resolution_notification_controller.h"
-#include "ash/display/screen_orientation_controller_chromeos.h"
-#include "ash/display/shutdown_observer_chromeos.h"
-#include "ash/sticky_keys/sticky_keys_controller.h"
-#include "ash/system/chromeos/power/power_event_observer.h"
-#include "ash/system/chromeos/power/video_activity_notifier.h"
-#include "ash/touch/touch_transformer_controller.h"
-#include "ash/virtual_keyboard_controller.h"
-#include "base/bind_helpers.h"
-#include "base/sys_info.h"
-#include "chromeos/audio/audio_a11y_controller.h"
-#include "chromeos/chromeos_switches.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "ui/chromeos/user_activity_power_manager_notifier.h"
-#include "ui/display/manager/chromeos/display_change_observer.h"
-#include "ui/display/manager/chromeos/display_configurator.h"
-
#if defined(USE_X11)
#include "ui/display/manager/chromeos/x11/native_display_delegate_x11.h"
+#include "ui/gfx/x/x11_types.h" // nogncheck
#endif
#if defined(USE_OZONE)
#include "ui/display/types/native_display_delegate.h"
#include "ui/ozone/public/ozone_platform.h"
#endif
-#endif // defined(OS_CHROMEOS)
namespace ash {
@@ -297,10 +292,8 @@ void Shell::OnLockStateChanged(bool locked) {
}
void Shell::OnCastingSessionStartedOrStopped(bool started) {
-#if defined(OS_CHROMEOS)
for (auto& observer : *wm_shell_->shell_observers())
observer.OnCastingSessionStartedOrStopped(started);
-#endif
}
void Shell::OnRootWindowAdded(WmWindow* root_window) {
@@ -327,13 +320,11 @@ void Shell::DeactivateKeyboard() {
keyboard::KeyboardController::ResetInstance(nullptr);
}
-#if defined(OS_CHROMEOS)
bool Shell::ShouldSaveDisplaySettings() {
return !(
screen_orientation_controller_->ignore_display_configuration_updates() ||
resolution_notification_controller_->DoesNotificationTimeout());
}
-#endif
void Shell::UpdateShelfVisibility() {
for (WmWindow* root : wm_shell_->GetAllRootWindows())
@@ -363,7 +354,6 @@ void Shell::SetTouchHudProjectionEnabled(bool enabled) {
observer.OnTouchHudProjectionToggled(enabled);
}
-#if defined(OS_CHROMEOS)
FirstRunHelper* Shell::CreateFirstRunHelper() {
return new FirstRunHelperImpl;
}
@@ -373,7 +363,6 @@ void Shell::SetCursorCompositingEnabled(bool enabled) {
->SetCursorCompositingEnabled(enabled);
native_cursor_manager_->SetNativeCursorEnabled(!enabled);
}
-#endif // defined(OS_CHROMEOS)
void Shell::DoInitialWorkspaceAnimation() {
return GetPrimaryRootWindowController()
@@ -388,9 +377,7 @@ Shell::Shell(ShellDelegate* delegate)
: wm_shell_(new WmShellAura(base::WrapUnique(delegate))),
link_handler_model_factory_(nullptr),
activation_client_(nullptr),
-#if defined(OS_CHROMEOS)
display_configurator_(new display::DisplayConfigurator()),
-#endif // defined(OS_CHROMEOS)
native_cursor_manager_(nullptr),
simulate_modal_window_open_for_testing_(false),
is_touch_hud_projection_enabled_(false) {
@@ -400,9 +387,7 @@ Shell::Shell(ShellDelegate* delegate)
window_tree_host_manager_.reset(new WindowTreeHostManager);
user_metrics_recorder_.reset(new UserMetricsRecorder);
-#if defined(OS_CHROMEOS)
PowerStatus::Initialize();
-#endif
}
Shell::~Shell() {
@@ -422,13 +407,13 @@ Shell::~Shell() {
window_modality_controller_.reset();
RemovePreTargetHandler(
window_tree_host_manager_->input_method_event_handler());
-#if defined(OS_CHROMEOS)
+
RemovePreTargetHandler(magnifier_key_scroll_handler_.get());
magnifier_key_scroll_handler_.reset();
RemovePreTargetHandler(speech_feedback_handler_.get());
speech_feedback_handler_.reset();
-#endif
+
RemovePreTargetHandler(overlay_filter_.get());
RemovePreTargetHandler(accelerator_filter_.get());
RemovePreTargetHandler(event_transformation_handler_.get());
@@ -441,17 +426,13 @@ Shell::~Shell() {
// TooltipController is deleted with the Shell so removing its references.
RemovePreTargetHandler(tooltip_controller_.get());
-#if defined(OS_CHROMEOS)
screen_orientation_controller_.reset();
screen_layout_observer_.reset();
-#endif
-// Destroy the virtual keyboard controller before the maximize mode controller
-// since the latters destructor triggers events that the former is listening
-// to but no longer cares about.
-#if defined(OS_CHROMEOS)
+ // Destroy the virtual keyboard controller before the maximize mode controller
+ // since the latters destructor triggers events that the former is listening
+ // to but no longer cares about.
virtual_keyboard_controller_.reset();
-#endif
// Destroy maximize mode controller early on since it has some observers which
// need to be removed.
@@ -476,12 +457,10 @@ Shell::~Shell() {
// Controllers who have WindowObserver added must be deleted
// before |window_tree_host_manager_| is deleted.
-#if defined(OS_CHROMEOS)
// VideoActivityNotifier must be deleted before |video_detector_| is
// deleted because it's observing video activity through
// VideoDetector::Observer interface.
video_activity_notifier_.reset();
-#endif // defined(OS_CHROMEOS)
video_detector_.reset();
high_contrast_controller_.reset();
@@ -513,19 +492,15 @@ Shell::~Shell() {
screen_pinning_controller_.reset();
-#if defined(OS_CHROMEOS)
resolution_notification_controller_.reset();
-#endif
screenshot_controller_.reset();
mouse_cursor_filter_.reset();
modality_filter_.reset();
-#if defined(OS_CHROMEOS)
touch_transformer_controller_.reset();
audio_a11y_controller_.reset();
laser_pointer_controller_.reset();
partial_magnification_controller_.reset();
-#endif // defined(OS_CHROMEOS)
// This also deletes all RootWindows. Note that we invoke Shutdown() on
// WindowTreeHostManager before resetting |window_tree_host_manager_|, since
@@ -543,7 +518,6 @@ Shell::~Shell() {
keyboard::KeyboardController::ResetInstance(nullptr);
-#if defined(OS_CHROMEOS)
display_color_manager_.reset();
if (display_change_observer_)
display_configurator_->RemoveObserver(display_change_observer_.get());
@@ -560,7 +534,6 @@ Shell::~Shell() {
// Ensure that DBusThreadManager outlives this Shell.
DCHECK(chromeos::DBusThreadManager::IsInitialized());
-#endif
// Needs to happen right before |instance_| is reset.
wm_shell_.reset();
@@ -574,22 +547,13 @@ void Shell::Init(const ShellInitParams& init_params) {
immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>();
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- NOTREACHED() << "linux desktop does not support ash.";
-#endif
-
scoped_overview_animation_settings_factory_.reset(
new ScopedOverviewAnimationSettingsFactoryAura);
window_positioner_.reset(new WindowPositioner(wm_shell_.get()));
native_cursor_manager_ = new AshNativeCursorManager;
-#if defined(OS_CHROMEOS)
cursor_manager_.reset(
new CursorManager(base::WrapUnique(native_cursor_manager_)));
-#else
- cursor_manager_.reset(
- new ::wm::CursorManager(base::WrapUnique(native_cursor_manager_)));
-#endif
wm_shell_->delegate()->PreInit();
bool display_initialized = display_manager_->InitFromCommandLine();
@@ -597,8 +561,6 @@ void Shell::Init(const ShellInitParams& init_params) {
display_configuration_controller_.reset(new DisplayConfigurationController(
display_manager_.get(), window_tree_host_manager_.get()));
-#if defined(OS_CHROMEOS)
-
#if defined(USE_OZONE)
display_configurator_->Init(
ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(),
@@ -640,7 +602,6 @@ void Shell::Init(const ShellInitParams& init_params) {
}
display_color_manager_.reset(new DisplayColorManager(
display_configurator_.get(), init_params.blocking_pool));
-#endif // defined(OS_CHROMEOS)
if (!display_initialized)
display_manager_->InitDefaultDisplay();
@@ -674,10 +635,8 @@ void Shell::Init(const ShellInitParams& init_params) {
aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow();
wm_shell_->set_root_window_for_new_windows(WmWindowAura::Get(root_window));
-#if defined(OS_CHROMEOS)
resolution_notification_controller_.reset(
new ResolutionNotificationController);
-#endif
if (cursor_manager_)
cursor_manager_->SetDisplay(
@@ -690,12 +649,10 @@ void Shell::Init(const ShellInitParams& init_params) {
AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler());
-#if defined(OS_CHROMEOS)
magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler();
AddPreTargetHandler(magnifier_key_scroll_handler_.get());
speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler();
AddPreTargetHandler(speech_feedback_handler_.get());
-#endif
// The order in which event filters are added is significant.
@@ -721,9 +678,7 @@ void Shell::Init(const ShellInitParams& init_params) {
system_gesture_filter_.reset(new SystemGestureEventFilter);
AddPreTargetHandler(system_gesture_filter_.get());
-#if defined(OS_CHROMEOS)
sticky_keys_controller_.reset(new StickyKeysController);
-#endif
screen_pinning_controller_.reset(
new ScreenPinningController(window_tree_host_manager_.get()));
@@ -731,11 +686,10 @@ void Shell::Init(const ShellInitParams& init_params) {
base::MakeUnique<LockStateController>(wm_shell_->shutdown_controller());
power_button_controller_.reset(
new PowerButtonController(lock_state_controller_.get()));
-#if defined(OS_CHROMEOS)
// Pass the initial display state to PowerButtonController.
power_button_controller_->OnDisplayModeChanged(
display_configurator_->cached_displays());
-#endif
+
wm_shell_->AddShellObserver(lock_state_controller_.get());
drag_drop_controller_.reset(new DragDropController);
@@ -752,10 +706,8 @@ void Shell::Init(const ShellInitParams& init_params) {
// RootWindowController as possible.
visibility_controller_.reset(new AshVisibilityController);
-#if defined(OS_CHROMEOS)
laser_pointer_controller_.reset(new LaserPointerController());
partial_magnification_controller_.reset(new PartialMagnificationController());
-#endif
magnification_controller_.reset(MagnificationController::CreateInstance());
wm_shell_->CreateMruWindowTracker();
@@ -784,27 +736,21 @@ void Shell::Init(const ShellInitParams& init_params) {
wm_shell_->SetSystemTrayDelegate(
base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate()));
-#if defined(OS_CHROMEOS)
// Create TouchTransformerController before
// WindowTreeHostManager::InitDisplays()
// since TouchTransformerController listens on
// WindowTreeHostManager::Observer::OnDisplaysInitialized().
touch_transformer_controller_.reset(new TouchTransformerController());
-#endif // defined(OS_CHROMEOS)
wm_shell_->SetKeyboardUI(KeyboardUI::Create());
window_tree_host_manager_->InitHosts();
-#if defined(OS_CHROMEOS)
// Needs to be created after InitDisplays() since it may cause the virtual
// keyboard to be deployed.
virtual_keyboard_controller_.reset(new VirtualKeyboardController);
-#endif // defined(OS_CHROMEOS)
-#if defined(OS_CHROMEOS)
audio_a11y_controller_.reset(new chromeos::AudioA11yController);
-#endif // defined(OS_CHROMEOS)
// Initialize the wallpaper after the RootWindowController has been created,
// otherwise the widget will not paint when restoring after a browser crash.
@@ -817,7 +763,6 @@ void Shell::Init(const ShellInitParams& init_params) {
cursor_manager_->SetCursor(ui::kCursorPointer);
}
-#if defined(OS_CHROMEOS)
power_event_observer_.reset(new PowerEventObserver());
user_activity_notifier_.reset(
new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get()));
@@ -826,7 +771,7 @@ void Shell::Init(const ShellInitParams& init_params) {
bluetooth_notification_controller_.reset(new BluetoothNotificationController);
screen_orientation_controller_.reset(new ScreenOrientationController());
screen_layout_observer_.reset(new ScreenLayoutObserver());
-#endif
+
// The compositor thread and main message loop have to be running in
// order to create mirror window. Run it after the main message loop
// is started.
@@ -848,17 +793,10 @@ void Shell::InitKeyboard() {
keyboard::KeyboardController::GetInstance());
}
}
-#if defined(OS_CHROMEOS)
keyboard::KeyboardController::ResetInstance(
new keyboard::KeyboardController(
wm_shell_->delegate()->CreateKeyboardUI(),
virtual_keyboard_controller_.get()));
-#else
- keyboard::KeyboardController::ResetInstance(
- new keyboard::KeyboardController(
- wm_shell_->delegate()->CreateKeyboardUI(), nullptr));
-
-#endif
}
}
« no previous file with comments | « ash/shell.h ('k') | ash/shell/content/client/shell_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698