[shortstand] Remove the flag kStandaloneWindowMigrationUx
The flag kStandaloneWindowMigrationUx is dependent on kCrosShortstand
(see IsStandaloneWindowMigrationUxEnabled() definition),
and we are in the process of deleting kCrosShortstand.
This CL rolls back http://crrev.com/c/5039996 and http://crrev.com/c/5087049
Also deleted the pref kStandaloneWindowMigrationNudgeShown.
BUG=b:338393239
Change-Id: Ifdb42493cbe4373bdf7daa33da124d2a3a5f99f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5752525
Reviewed-by: Scott Violet <[email protected]>
Auto-Submit: Oleg Nitz <[email protected]>
Reviewed-by: Jiaming Cheng <[email protected]>
Reviewed-by: Rushan Suleymanov <[email protected]>
Commit-Queue: Oleg Nitz <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1336549}
diff --git a/chrome/browser/ash/preferences.cc b/chrome/browser/ash/preferences.cc
index b4ef46d..9255466 100644
--- a/chrome/browser/ash/preferences.cc
+++ b/chrome/browser/ash/preferences.cc
@@ -669,9 +669,6 @@
registry->RegisterDictionaryPref(prefs::kAshAppIconSortableColorGroupCache);
registry->RegisterDictionaryPref(prefs::kAshAppIconSortableColorHueCache);
- registry->RegisterBooleanPref(::prefs::kStandaloneWindowMigrationNudgeShown,
- false);
-
registry->RegisterStringPref(::prefs::kFilesAppDefaultLocation,
std::string());
}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 4da3cf2..6636e50 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1031,6 +1031,12 @@
constexpr char kShowTunaScreenEnabled[] = "ash.tuna_screen_oobe_enabled";
#endif
+// Deprecated 08/2024
+#if BUILDFLAG(IS_CHROMEOS)
+inline constexpr char kStandaloneWindowMigrationNudgeShown[] =
+ "standalone_window_migration_nudge_shown";
+#endif
+
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1415,6 +1421,11 @@
// Deprecated 07/2024.
registry->RegisterBooleanPref(kShowTunaScreenEnabled, true);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+// Deprecated 08/2024
+#if BUILDFLAG(IS_CHROMEOS)
+ registry->RegisterBooleanPref(kStandaloneWindowMigrationNudgeShown, false);
+#endif
}
void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -2708,6 +2719,11 @@
profile_prefs->ClearPref(kShowTunaScreenEnabled);
#endif
+// Added 08/2024
+#if BUILDFLAG(IS_CHROMEOS)
+ profile_prefs->ClearPref(kStandaloneWindowMigrationNudgeShown);
+#endif
+
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS
diff --git a/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc b/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc
index 352876f3e..89233de 100644
--- a/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc
+++ b/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc
@@ -318,7 +318,7 @@
kProfileContentSettingsPartitionedExceptionsMouselock = 100258,
kProfileContentSettingsPartitionedExceptionsPopups = 100259,
kProfileContentSettingsPartitionedExceptionsWindowPlacement = 100260,
- kStandaloneWindowMigrationNudgeShown = 100261,
+ // kStandaloneWindowMigrationNudgeShown = 100261, (deprecated)
kTabDiscardingExceptionsWithTime = 100262,
kAccessibilityFaceGazeCursorSpeedUp = 100263,
kAccessibilityFaceGazeCursorSpeedDown = 100264,
@@ -1114,10 +1114,6 @@
{syncable_prefs_ids::kApplicationLocale, syncer::OS_PRIORITY_PREFERENCES,
sync_preferences::PrefSensitivity::kNone,
sync_preferences::MergeBehavior::kNone}},
- {prefs::kStandaloneWindowMigrationNudgeShown,
- {syncable_prefs_ids::kStandaloneWindowMigrationNudgeShown,
- syncer::OS_PREFERENCES, sync_preferences::PrefSensitivity::kNone,
- sync_preferences::MergeBehavior::kNone}},
{ash::prefs::kAccessibilityFaceGazeCursorSpeedUp,
{syncable_prefs_ids::kAccessibilityFaceGazeCursorSpeedUp,
syncer::OS_PREFERENCES, sync_preferences::PrefSensitivity::kNone,
diff --git a/chrome/browser/ui/ash/shelf/BUILD.gn b/chrome/browser/ui/ash/shelf/BUILD.gn
index 064f800..ef78bd2a 100644
--- a/chrome/browser/ui/ash/shelf/BUILD.gn
+++ b/chrome/browser/ui/ash/shelf/BUILD.gn
@@ -76,8 +76,6 @@
"standalone_browser_extension_app_context_menu.h",
"standalone_browser_extension_app_shelf_item_controller.cc",
"standalone_browser_extension_app_shelf_item_controller.h",
- "standalone_window_migration_nudge_util.cc",
- "standalone_window_migration_nudge_util.h",
]
public_deps = [ "//chrome/browser:browser_public_dependencies" ]
@@ -274,7 +272,6 @@
"browser_shortcut_shelf_item_controller_browsertest.cc",
"chrome_shelf_controller_browsertest.cc",
"extension_shelf_context_menu_browsertest.cc",
- "standalone_window_migration_nudge_browsertest.cc",
]
deps = [
diff --git a/chrome/browser/ui/ash/shelf/browser_app_shelf_controller.cc b/chrome/browser/ui/ash/shelf/browser_app_shelf_controller.cc
index 64c866a..fbcc585 100644
--- a/chrome/browser/ui/ash/shelf/browser_app_shelf_controller.cc
+++ b/chrome/browser/ui/ash/shelf/browser_app_shelf_controller.cc
@@ -6,9 +6,7 @@
#include <memory>
-#include "ash/constants/ash_features.h"
#include "ash/public/cpp/window_properties.h"
-#include "ash/root_window_controller.h"
#include "base/debug/dump_without_crashing.h"
#include "base/strings/string_util.h"
#include "chrome/browser/apps/browser_instance/browser_app_instance.h"
@@ -86,9 +84,6 @@
case apps::BrowserAppInstance::Type::kAppWindow: {
shelf_spinner_controller_->CloseSpinner(instance.app_id);
CreateOrUpdateShelfItem(id, ash::STATUS_RUNNING);
- if (ash::features::IsStandaloneWindowMigrationUxEnabled()) {
- MaybeShowStandaloneMigrationNudge(instance.app_id, profile_);
- }
break;
}
case apps::BrowserAppInstance::Type::kAppTab:
diff --git a/chrome/browser/ui/ash/shelf/browser_status_monitor.cc b/chrome/browser/ui/ash/shelf/browser_status_monitor.cc
index 55e70d0..da2d1d4 100644
--- a/chrome/browser/ui/ash/shelf/browser_status_monitor.cc
+++ b/chrome/browser/ui/ash/shelf/browser_status_monitor.cc
@@ -6,13 +6,10 @@
#include <memory>
-#include "ash/constants/ash_features.h"
#include "ash/public/cpp/shelf_types.h"
#include "base/containers/contains.h"
#include "base/debug/dump_without_crashing.h"
#include "base/memory/raw_ptr.h"
-#include "chrome/browser/apps/app_service/app_service_proxy_ash.h"
-#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_controller.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
@@ -197,15 +194,6 @@
if (IsAppBrowser(browser) &&
multi_user_util::IsProfileFromActiveUser(browser->profile())) {
AddAppBrowserToShelf(browser);
- if (!ash::features::IsStandaloneWindowMigrationUxEnabled()) {
- return;
- }
- std::string app_id =
- web_app::GetAppIdFromApplicationName(browser->app_name());
- if (app_id.empty()) {
- return;
- }
- MaybeShowStandaloneMigrationNudge(app_id, browser->profile());
}
}
}
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.cc
index e644c7a8a..e33008c 100644
--- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.cc
+++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.cc
@@ -7,13 +7,6 @@
#include "ash/constants/ash_features.h"
#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/shelf_model.h"
-#include "ash/public/cpp/window_properties.h"
-#include "ash/root_window_controller.h"
-#include "ash/shelf/shelf.h"
-#include "ash/shelf/shelf_app_button.h"
-#include "ash/shelf/shelf_view.h"
-#include "ash/shelf/shelf_widget.h"
-#include "ash/shell.h"
#include "base/containers/contains.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
@@ -36,7 +29,6 @@
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_item_factory.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_prefs.h"
-#include "chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/web_applications/policy/web_app_policy_manager.h"
#include "chrome/browser/web_applications/web_app_constants.h"
@@ -294,50 +286,3 @@
scalable_iph->MaybeRecordShelfItemActivationById(app_id);
}
-
-void MaybeShowStandaloneMigrationNudge(const std::string& app_id,
- Profile* profile) {
- CHECK(ash::Shell::GetPrimaryRootWindowController());
- ash::ShelfView* shelf_view = ash::Shell::GetPrimaryRootWindowController()
- ->shelf()
- ->hotseat_widget()
- ->GetShelfView();
-
- CHECK(profile);
- CHECK(shelf_view);
-
- ash::ShelfAppButton* anchor_view =
- shelf_view->GetShelfAppButton(ash::ShelfID(app_id));
-
- auto* app_service_proxy =
- apps::AppServiceProxyFactory::GetForProfile(profile);
-
- CHECK(app_service_proxy);
-
- std::string app_name;
- apps::WindowMode window_mode;
-
- // Retrieving an app's window mode, set prior to the default window mode
- // change, allows us to verify whether the nudge should be shown on opening
- // this app. The nudge is to only be shown for apps previously displayed
- // within the browser by default.
- app_service_proxy->AppRegistryCache().ForOneApp(
- app_id, [&app_name, &window_mode](const apps::AppUpdate& update) {
- app_name = update.Name();
- window_mode = update.WindowMode();
- });
-
- if (window_mode != apps::WindowMode::kBrowser) {
- return;
- }
-
- PrefService* prefs = profile->GetPrefs();
-
- if (prefs->GetBoolean(prefs::kStandaloneWindowMigrationNudgeShown)) {
- return;
- }
-
- prefs->SetBoolean(prefs::kStandaloneWindowMigrationNudgeShown, true);
-
- ash::CreateAndShowNudge(anchor_view, base::UTF8ToUTF16(app_name));
-}
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.h b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.h
index 399dc14..bbeb3bec 100644
--- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.h
+++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.h
@@ -81,9 +81,4 @@
Profile* profile,
ash::ShelfLaunchSource source);
-// Displays a nudge notifying users of affected web apps now opening in
-// standalone windows by default, which previously opened in tabs.
-void MaybeShowStandaloneMigrationNudge(const std::string& app_id,
- Profile* profile);
-
#endif // CHROME_BROWSER_UI_ASH_SHELF_CHROME_SHELF_CONTROLLER_UTIL_H_
diff --git a/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_browsertest.cc b/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_browsertest.cc
deleted file mode 100644
index 9d40ba6..0000000
--- a/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_browsertest.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/constants/ash_features.h"
-#include "ash/public/cpp/system/anchored_nudge_data.h"
-#include "ash/shell.h"
-#include "ash/system/toast/anchored_nudge_manager_impl.h"
-#include "chrome/browser/ui/ash/shelf/browser_status_monitor.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
-#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "chromeos/ash/components/standalone_browser/standalone_browser_features.h"
-#include "chromeos/constants/chromeos_features.h"
-#include "content/public/test/browser_test.h"
-
-namespace {
-constexpr char kNudgeId[] = "migration_ux_nudge_id";
-}
-
-class StandaloneWindowMigrationNudgeBrowserTest : public InProcessBrowserTest {
- protected:
- StandaloneWindowMigrationNudgeBrowserTest() {
- std::vector<base::test::FeatureRef> enabled_features = {
- chromeos::features::kCrosShortstand,
- ash::features::kStandaloneWindowMigrationUx};
- scoped_feature_list_.InitWithFeatures(
- enabled_features, {ash::standalone_browser::features::kLacrosOnly});
- }
-
- void SetUpOnMainThread() override { ASSERT_TRUE(controller()); }
-
- webapps::AppId CreateWebApp(const GURL& app_url,
- const std::u16string& app_name,
- web_app::mojom::UserDisplayMode display_mode) {
- auto web_app_info =
- web_app::WebAppInstallInfo::CreateWithStartUrlForTesting(app_url);
- web_app_info->title = app_name;
- web_app_info->user_display_mode = display_mode;
-
- return web_app::test::InstallWebApp(browser()->profile(),
- std::move(web_app_info));
- }
-
- ChromeShelfController* controller() {
- return ChromeShelfController::instance();
- }
-
- private:
- base::test::ScopedFeatureList scoped_feature_list_;
-};
-
-// TODO(https://crbug.com/332642058): Test is flaky on Linux Chromium OS ASan
-// LSan Tests.
-#if defined(ADDRESS_SANITIZER)
-#define MAYBE_CheckNudge DISABLED_CheckNudge
-#else
-#define MAYBE_CheckNudge CheckNudge
-#endif
-IN_PROC_BROWSER_TEST_F(StandaloneWindowMigrationNudgeBrowserTest,
- MAYBE_CheckNudge) {
- GURL app_url = GURL("https://example.org/");
- std::u16string app_name = u"app_name";
-
- auto app_id = CreateWebApp(app_url, app_name,
- web_app::mojom::UserDisplayMode::kBrowser);
-
- Browser* app_browser =
- web_app::LaunchWebAppBrowserAndWait(browser()->profile(), app_id);
-
- ASSERT_TRUE(ui_test_utils::NavigateToURL(app_browser, app_url));
-
- ash::AnchoredNudgeManager* anchored_nudge_manager =
- ash::AnchoredNudgeManager::Get();
- ASSERT_TRUE(anchored_nudge_manager);
-
- EXPECT_TRUE(anchored_nudge_manager->IsNudgeShown(kNudgeId));
-}
-
-IN_PROC_BROWSER_TEST_F(StandaloneWindowMigrationNudgeBrowserTest,
- CheckNudgeDoesNotShow) {
- GURL app_url = GURL("https://example.org/");
- std::u16string app_name = u"app_name";
-
- auto app_id = CreateWebApp(app_url, app_name,
- web_app::mojom::UserDisplayMode::kStandalone);
-
- Browser* app_browser =
- web_app::LaunchWebAppBrowserAndWait(browser()->profile(), app_id);
-
- ASSERT_TRUE(ui_test_utils::NavigateToURL(app_browser, app_url));
-
- ash::AnchoredNudgeManager* anchored_nudge_manager =
- ash::AnchoredNudgeManager::Get();
- ASSERT_TRUE(anchored_nudge_manager);
-
- EXPECT_FALSE(anchored_nudge_manager->IsNudgeShown(kNudgeId));
-}
diff --git a/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.cc b/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.cc
deleted file mode 100644
index 5364f60..0000000
--- a/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.h"
-
-#include "ash/public/cpp/system/anchored_nudge_data.h"
-#include "ash/public/cpp/system/anchored_nudge_manager.h"
-#include "base/functional/bind.h"
-#include "base/functional/callback_helpers.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/strings/grit/components_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/views/bubble/bubble_border.h"
-#include "ui/views/view.h"
-
-namespace ash {
-
-namespace {
-
-constexpr char kNudgeId[] = "migration_ux_nudge_id";
-
-}
-
-void CreateAndShowNudge(views::View* anchor_view, std::u16string view_title) {
- ash::AnchoredNudgeData nudge = ash::AnchoredNudgeData(
- kNudgeId, NudgeCatalogName::kStandaloneWindowMigrationUx,
- l10n_util::GetStringUTF16(IDS_STANDALONE_WINDOW_MIGRATION_UX_BUBBLE_TEXT),
- anchor_view);
- nudge.arrow = views::BubbleBorder::BOTTOM_RIGHT;
- nudge.title_text = l10n_util::GetStringFUTF16(
- IDS_STANDALONE_WINDOW_MIGRATION_UX_BUBBLE_HEADING, view_title);
- nudge.primary_button_text =
- l10n_util::GetStringUTF16(IDS_STANDALONE_WINDOW_MIGRATION_UX_GOT_IT);
- nudge.secondary_button_text = l10n_util::GetStringUTF16(IDS_LEARN_MORE);
- nudge.secondary_button_callback =
- base::BindRepeating(&OnLearnMoreButtonSelected);
-
- ash::AnchoredNudgeManager::Get()->Show(nudge);
-}
-
-void OnLearnMoreButtonSelected() {
- // TODO(b/319328360): Implement. Details of this callback are not yet
- // finalized. This callback should link the user to a help document.
-}
-
-} // namespace ash
diff --git a/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.h b/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.h
deleted file mode 100644
index 083dabc..0000000
--- a/chrome/browser/ui/ash/shelf/standalone_window_migration_nudge_util.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_ASH_SHELF_STANDALONE_WINDOW_MIGRATION_NUDGE_UTIL_H_
-#define CHROME_BROWSER_UI_ASH_SHELF_STANDALONE_WINDOW_MIGRATION_NUDGE_UTIL_H_
-
-#include <string>
-
-namespace views {
-class View;
-}
-
-namespace ash {
-// This function creates a specific instance of `AnchoredNudgeData`, used to
-// notify users of affected web apps now opening in standalone windows by
-// default.
-void CreateAndShowNudge(views::View* anchor_view, std::u16string view_title);
-
-// Callback called when 'Learn more' button on nudge is selected. The actions
-// of this callback are to be finalized, and have not yet been implemented.
-void OnLearnMoreButtonSelected();
-
-} // namespace ash
-
-#endif // CHROME_BROWSER_UI_ASH_SHELF_STANDALONE_WINDOW_MIGRATION_NUDGE_UTIL_H_