Commit 5c5a1e04 authored by Jiewei Qian's avatar Jiewei Qian Committed by Chromium LUCI CQ

ui: stop SettingsWindowManager from managing SWA OS Settings window

SWA has it's own logic for managing windows for OS Settings SWA.
SettingsWindowManager should only be used for legacy OS Settings.

This CL stops notifying observers about creation of SWA OS Settings
windows. This is safe because the only use case is
SettingsWindowObserver, which is only initialized if legacy settings
window is used (but never initialized if SWA is used).

See chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc.

This CL is a preparation for https://crbug.com/1154540, where we
implement a new LaunchSWA API. The new API uses AppService to launch the
app, and won't return the Browser object hosting the app window.

Bug: 1154540
Change-Id: I7ba5d4bc1ab6928168b0bc17016ab6684ca1f2cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568340
Commit-Queue: Jiewei Qian  <qjw@chromium.org>
Auto-Submit: Jiewei Qian  <qjw@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834541}
parent acbacd86
...@@ -5,11 +5,9 @@ ...@@ -5,11 +5,9 @@
#include "chrome/browser/ui/settings_window_manager_chromeos.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/multi_user_window_manager.h"
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h" #include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h"
#include "chrome/browser/ui/ash/window_properties.h" #include "chrome/browser/ui/ash/window_properties.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
...@@ -34,17 +32,6 @@ namespace { ...@@ -34,17 +32,6 @@ namespace {
bool g_force_deprecated_settings_window_for_testing = false; bool g_force_deprecated_settings_window_for_testing = false;
// This method handles the case of resurfacing the user's OS Settings
// standalone window that may be at the time located on another user's desktop.
void ShowSettingsOnCurrentDesktop(Browser* browser) {
auto* window_manager = MultiUserWindowManagerHelper::GetWindowManager();
if (window_manager && browser) {
window_manager->ShowWindowForUser(browser->window()->GetNativeWindow(),
window_manager->CurrentAccountId());
browser->window()->Show();
}
}
} // namespace } // namespace
// static // static
...@@ -84,18 +71,10 @@ void SettingsWindowManager::ShowChromePageForProfile(Profile* profile, ...@@ -84,18 +71,10 @@ void SettingsWindowManager::ShowChromePageForProfile(Profile* profile,
// TODO(crbug.com/1067073): Remove legacy Settings Window. // TODO(crbug.com/1067073): Remove legacy Settings Window.
if (!UseDeprecatedSettingsWindow(profile)) { if (!UseDeprecatedSettingsWindow(profile)) {
bool did_create; web_app::LaunchSystemWebApp(profile, web_app::SystemAppType::SETTINGS,
Browser* browser = web_app::LaunchSystemWebApp( gurl);
profile, web_app::SystemAppType::SETTINGS, gurl, // SWA OS Settings don't use SettingsWindowManager to manage windows, don't
/*params=*/base::nullopt, &did_create); // notify SettingsWindowObservers.
ShowSettingsOnCurrentDesktop(browser);
// Only notify if we created a new browser.
if (!did_create || !browser)
return;
for (SettingsWindowManagerObserver& observer : observers_)
observer.OnNewSettingsWindow(browser);
return; return;
} }
......
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