Commit 1e0c025c authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Cleanup some usage of IsAshInBrowserProcess

We need to distinguish between MultiProcessMash, SingleProcessMash and
both (aka IsUsingWindowService). Clean up some usage in login and
accessibility.

Bug: 874468
Change-Id: Ibf9694f45114491bf54b232a906b6a5a390e3f05
Reviewed-on: https://chromium-review.googlesource.com/1180344
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584613}
parent e6450a95
......@@ -67,7 +67,7 @@ void RegisterOutOfProcessServices(
ContentBrowserClient::OutOfProcessServiceMap* services) {
RegisterOutOfProcessServicesImpl(kCommonServices, base::size(kCommonServices),
services);
if (!features::IsAshInBrowserProcess()) {
if (features::IsMultiProcessMash()) {
RegisterOutOfProcessServicesImpl(kMashServices, base::size(kMashServices),
services);
}
......@@ -97,7 +97,7 @@ void RegisterInProcessServices(
(*services)[ax::mojom::kAXHostServiceName] = info;
}
if (!features::IsAshInBrowserProcess())
if (features::IsMultiProcessMash())
return;
(*services)[ash::mojom::kServiceName] =
......
......@@ -208,7 +208,7 @@ void BrowserProcessPlatformPart::DestroySystemClock() {
ui::InputDeviceControllerClient*
BrowserProcessPlatformPart::GetInputDeviceControllerClient() {
if (!input_device_controller_client_) {
const std::string service_name = features::IsAshInBrowserProcess()
const std::string service_name = !features::IsMultiProcessMash()
? chromeos::kChromeServiceName
: ui::mojom::kServiceName;
input_device_controller_client_ =
......
......@@ -333,7 +333,7 @@ void AccessibilityManager::UpdateAlwaysShowMenuFromPref() {
return;
// TODO(crbug.com/594887): Fix for mash by moving pref into ash.
if (!features::IsAshInBrowserProcess())
if (features::IsMultiProcessMash())
return;
// Update system tray menu visibility.
......@@ -881,8 +881,8 @@ void AccessibilityManager::InputMethodChanged(
Profile* /* profile */,
bool show_message) {
// Sticky keys is implemented only in ash.
// TODO(dpolukhin): support Athena, crbug.com/408733.
if (features::IsAshInBrowserProcess()) {
// TODO(crbug.com/678820): Mash support.
if (!features::IsMultiProcessMash()) {
ash::Shell::Get()->sticky_keys_controller()->SetModifiersEnabled(
manager->IsISOLevel5ShiftUsedByCurrentInputMethod(),
manager->IsAltGrUsedByCurrentInputMethod());
......@@ -1043,7 +1043,7 @@ void AccessibilityManager::NotifyAccessibilityStatusChanged(
callback_list_.Notify(details);
// TODO(crbug.com/594887): Fix for mash by moving pref into ash.
if (!features::IsAshInBrowserProcess())
if (features::IsMultiProcessMash())
return;
if (details.notification_type == ACCESSIBILITY_TOGGLE_DICTATION) {
......
......@@ -78,7 +78,7 @@ AccessibilityPanel::AccessibilityPanel(content::BrowserContext* browser_context,
// TODO(jamescook|fsamuel): Fix this. It causes a white flash when opening the
// window. The underlying problem is FrameToken plumbing, see
// ui::ws::ServerWindow::OnFrameTokenChanged. https://crbug.com/771331
if (!features::IsAshInBrowserProcess())
if (features::IsMultiProcessMash())
widget_->Show();
}
......
......@@ -322,7 +322,7 @@ class DBusServices {
DBusThreadManager::Get()->GetSystemBus(),
chromeos::DBusThreadManager::Get()->IsUsingFakes());
if (features::IsAshInBrowserProcess()) {
if (!features::IsMultiProcessMash()) {
// In Mash, power policy is sent to powerd by ash.
PowerPolicyController::Initialize(
DBusThreadManager::Get()->GetPowerManagerClient());
......@@ -424,7 +424,7 @@ class DBusServices {
drive_file_stream_service_.reset();
ProcessDataCollector::Shutdown();
PowerDataCollector::Shutdown();
if (features::IsAshInBrowserProcess())
if (!features::IsMultiProcessMash())
PowerPolicyController::Shutdown();
device::BluetoothAdapterFactory::Shutdown();
bluez::BluezDBusManager::Shutdown();
......@@ -752,13 +752,10 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() {
AccessibilityManager::Initialize();
if (features::IsAshInBrowserProcess()) {
if (!features::IsMultiProcessMash()) {
// Initialize magnification manager before ash tray is created. And this
// must be placed after UserManager::SessionStarted();
// TODO(sad): These components expects the ash::Shell instance to be
// created. However, when running as a mus-client, an ash::Shell instance is
// not created. These accessibility services should instead be exposed as
// separate services. crbug.com/557401
// TODO(crbug.com/821551): Mash support.
MagnificationManager::Initialize();
}
......@@ -1027,7 +1024,7 @@ void ChromeBrowserMainPartsChromeos::PostBrowserStart() {
spoken_feedback_event_rewriter_delegate_ =
std::make_unique<SpokenFeedbackEventRewriterDelegate>();
if (features::IsAshInBrowserProcess()) {
if (!features::IsMultiProcessMash()) {
// TODO(mash): Support EventRewriterController; see crbug.com/647781
ash::EventRewriterController* event_rewriter_controller =
ash::Shell::Get()->event_rewriter_controller();
......@@ -1117,7 +1114,7 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
// Detach D-Bus clients before DBusThreadManager is shut down.
idle_action_warning_observer_.reset();
if (features::IsAshInBrowserProcess())
if (!features::IsMultiProcessMash())
MagnificationManager::Shutdown();
media::SoundsManager::Shutdown();
......@@ -1165,7 +1162,8 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
// ChromeBrowserMainPartsLinux::PostMainMessageLoopRun().
arc_service_launcher_.reset();
if (features::IsAshInBrowserProcess())
// TODO(crbug.com/594887): Mash support.
if (!features::IsMultiProcessMash())
AccessibilityManager::Shutdown();
input_method::Shutdown();
......
......@@ -77,7 +77,7 @@ bool WebUIScreenLocker::ShouldPreloadLockScreen() {
// Bail for mash because IdleDetector/UserActivityDetector does not work
// properly there.
// TODO(xiyuan): Revisit after http://crbug.com/626899.
if (!features::IsAshInBrowserProcess())
if (features::IsMultiProcessMash())
return false;
Profile* profile = ProfileHelper::Get()->GetProfileByUser(
......
......@@ -12,9 +12,8 @@
namespace chromeos {
InputEventsBlocker::InputEventsBlocker() {
// TODO(mash): Implement a mash version. This will probably need to talk to
// the window server.
if (features::IsAshInBrowserProcess()) {
// TODO(crbug.com/854323): Mash support. Needs mojo API, or to move to ash.
if (!features::IsMultiProcessMash()) {
ash::Shell::Get()->AddPreTargetHandler(this,
ui::EventTarget::Priority::kSystem);
VLOG(1) << "InputEventsBlocker " << this << " created.";
......@@ -24,7 +23,7 @@ InputEventsBlocker::InputEventsBlocker() {
}
InputEventsBlocker::~InputEventsBlocker() {
if (features::IsAshInBrowserProcess()) {
if (!features::IsMultiProcessMash()) {
ash::Shell::Get()->RemovePreTargetHandler(this);
VLOG(1) << "InputEventsBlocker " << this << " destroyed.";
} else {
......
......@@ -49,7 +49,8 @@ LoginDisplayHostCommon::LoginDisplayHostCommon() : weak_factory_(this) {
// Disable Drag'n'Drop for the login session.
// ash::Shell may be null in tests.
if (ash::Shell::HasInstance() && features::IsAshInBrowserProcess()) {
// TODO(crbug.com/854328): Mash support.
if (ash::Shell::HasInstance() && !features::IsUsingWindowService()) {
scoped_drag_drop_disabler_.reset(
new wm::ScopedDragDropDisabler(ash::Shell::GetPrimaryRootWindow()));
} else {
......
......@@ -408,7 +408,7 @@ class LoginDisplayHostWebUI::LoginWidgetDelegate
// * Ash crash at the login screen on mustash
// In the latter case the mash root process will trigger a clean restart
// of content_browser.
if (!features::IsAshInBrowserProcess() && login_display_host_)
if (features::IsUsingWindowService() && login_display_host_)
login_display_host_->ResetLoginWindowAndView();
}
void DeleteDelegate() override { delete this; }
......@@ -431,7 +431,7 @@ class LoginDisplayHostWebUI::LoginWidgetDelegate
LoginDisplayHostWebUI::LoginDisplayHostWebUI()
: oobe_startup_sound_played_(StartupUtils::IsOobeCompleted()),
weak_factory_(this) {
if (!features::IsAshInBrowserProcess()) {
if (features::IsUsingWindowService()) {
// Animation, and initializing hidden, are not currently supported for Mash.
finalize_animation_type_ = ANIMATION_NONE;
initialize_webui_hidden_ = false;
......@@ -450,19 +450,19 @@ LoginDisplayHostWebUI::LoginDisplayHostWebUI()
bool zero_delay_enabled = WizardController::IsZeroDelayEnabled();
// Mash always runs login screen with zero delay
if (!features::IsAshInBrowserProcess())
if (features::IsUsingWindowService())
zero_delay_enabled = true;
waiting_for_wallpaper_load_ = !zero_delay_enabled;
// Initializing hidden is not supported in Mash
if (features::IsAshInBrowserProcess()) {
if (!features::IsUsingWindowService()) {
initialize_webui_hidden_ =
kHiddenWebUIInitializationDefault && !zero_delay_enabled;
}
// Check if WebUI init type is overriden. Not supported in Mash.
if (features::IsAshInBrowserProcess() &&
if (!features::IsUsingWindowService() &&
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshWebUIInit)) {
const std::string override_type =
......@@ -632,7 +632,7 @@ void LoginDisplayHostWebUI::OnStartUserAdding() {
restore_path_ = RESTORE_ADD_USER_INTO_SESSION;
// Animation is not supported in Mash
if (features::IsAshInBrowserProcess())
if (!features::IsUsingWindowService())
finalize_animation_type_ = ANIMATION_ADD_USER;
// Observe the user switch animation and defer the deletion of itself only
// after the animation is finished.
......@@ -648,7 +648,7 @@ void LoginDisplayHostWebUI::OnStartUserAdding() {
// We should emit this signal only at login screen (after reboot or sign out).
login_view_->set_should_emit_login_prompt_visible(false);
if (features::IsAshInBrowserProcess()) {
if (!features::IsUsingWindowService()) {
// Lock container can be transparent after lock screen animation.
aura::Window* lock_container = ash::Shell::GetContainer(
ash::Shell::GetPrimaryRootWindow(),
......@@ -689,7 +689,7 @@ void LoginDisplayHostWebUI::OnStartSignInScreen(
restore_path_ = RESTORE_SIGN_IN;
is_showing_login_ = true;
// Animation is not supported in Mash
if (features::IsAshInBrowserProcess())
if (!features::IsUsingWindowService())
finalize_animation_type_ = ANIMATION_WORKSPACE;
if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) {
......@@ -738,7 +738,7 @@ void LoginDisplayHostWebUI::OnPreferencesChanged() {
void LoginDisplayHostWebUI::OnStartAppLaunch() {
// Animation is not supported in Mash.
if (features::IsAshInBrowserProcess())
if (!features::IsUsingWindowService())
finalize_animation_type_ = ANIMATION_FADE_OUT;
if (!login_window_)
LoadURL(GURL(kAppLaunchSplashURL));
......@@ -748,7 +748,7 @@ void LoginDisplayHostWebUI::OnStartAppLaunch() {
void LoginDisplayHostWebUI::OnStartArcKiosk() {
// Animation is not supported in Mash.
if (features::IsAshInBrowserProcess())
if (!features::IsUsingWindowService())
finalize_animation_type_ = ANIMATION_FADE_OUT;
if (!login_window_) {
LoadURL(GURL(kAppLaunchSplashURL));
......@@ -925,7 +925,7 @@ void LoginDisplayHostWebUI::OnUserSwitchAnimationFinished() {
// LoginDisplayHostWebUI, private
void LoginDisplayHostWebUI::ScheduleWorkspaceAnimation() {
if (!features::IsAshInBrowserProcess()) {
if (features::IsUsingWindowService()) {
NOTIMPLEMENTED();
return;
}
......@@ -1036,7 +1036,7 @@ void LoginDisplayHostWebUI::InitLoginWindowAndView() {
? ash::kShellWindowId_AlwaysOnTopContainer
: ash::kShellWindowId_LockScreenContainer;
// The ash::Shell containers are not available in Mash
if (features::IsAshInBrowserProcess()) {
if (!features::IsUsingWindowService()) {
params.parent =
ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), container);
} else {
......@@ -1056,7 +1056,7 @@ void LoginDisplayHostWebUI::InitLoginWindowAndView() {
// Animations are not available in Mash.
// For voice interaction OOBE, we do not want the animation here.
if (features::IsAshInBrowserProcess() && !is_voice_interaction_oobe_) {
if (!features::IsUsingWindowService() && !is_voice_interaction_oobe_) {
login_window_->SetVisibilityAnimationDuration(
base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
login_window_->SetVisibilityAnimationTransition(
......@@ -1089,7 +1089,7 @@ void LoginDisplayHostWebUI::ResetLoginWindowAndView() {
}
if (login_window_) {
if (!features::IsAshInBrowserProcess()) {
if (features::IsUsingWindowService()) {
login_window_->Close();
} else {
login_window_->Hide();
......
......@@ -40,7 +40,7 @@ void SetupWidgetInitParamsForContainer(views::Widget::InitParams* params,
DCHECK_GE(container_id, ash::kShellWindowId_MinContainer);
DCHECK_LE(container_id, ash::kShellWindowId_MaxContainer);
if (!features::IsAshInBrowserProcess()) {
if (features::IsUsingWindowService()) {
using ui::mojom::WindowManager;
params->mus_properties[WindowManager::kContainerId_InitProperty] =
mojo::ConvertTo<std::vector<uint8_t>>(container_id);
......
......@@ -133,13 +133,17 @@ const base::Feature kSingleProcessMash = {"SingleProcessMash",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsUsingWindowService() {
return IsSingleProcessMash() || !IsAshInBrowserProcess();
return IsSingleProcessMash() || IsMultiProcessMash();
}
bool IsAshInBrowserProcess() {
return !base::FeatureList::IsEnabled(features::kMash);
}
bool IsMultiProcessMash() {
return base::FeatureList::IsEnabled(features::kMash);
}
bool IsSingleProcessMash() {
return base::FeatureList::IsEnabled(features::kSingleProcessMash);
}
......
......@@ -57,8 +57,13 @@ UI_BASE_EXPORT bool IsUsingWindowService();
// Returns true if ash is in process (the default). A value of false means ash
// is running in a separate process (and is hosting the UI Service and Viz).
// DEPRECATED: Use !IsMultiProcessMash() or !IsUsingWindowService().
UI_BASE_EXPORT bool IsAshInBrowserProcess();
// Returns true if ash in running in a separate process (and is hosting the UI
// service and Viz graphics).
UI_BASE_EXPORT bool IsMultiProcessMash();
// Returns true if code outside of ash is using the WindowService. In this mode
// there are two aura::Envs. Ash uses one with Env::Mode::LOCAL. Non-ash code
// uses an aura::Env with a mode of MUS. The non-ash code using mus targets the
......
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