Skip to content

Commit

Permalink
Remove show-app-list switch.
Browse files Browse the repository at this point in the history
Bug: 600915
Change-Id: Ie4125a40ecf161481bc03fd500ae5d202d8a9cfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2312956
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794532}
  • Loading branch information
David Bienvenu authored and Commit Bot committed Aug 4, 2020
1 parent be419b1 commit d6fec8a
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 69 deletions.
18 changes: 2 additions & 16 deletions chrome/app/chrome_exe_main_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,13 @@

namespace {

// List of switches that it's safe to rendezvous early with. Fast start should
// not be done if a command line contains a switch not in this set.
// Note this is currently stored as a list of two because it's probably faster
// to iterate over this small array than building a map for constant time
// lookups.
const char* const kFastStartSwitches[] = {
switches::kProfileDirectory,
switches::kShowAppList,
};

bool IsFastStartSwitch(const std::string& command_line_switch) {
for (size_t i = 0; i < base::size(kFastStartSwitches); ++i) {
if (command_line_switch == kFastStartSwitches[i])
return true;
}
return false;
return command_line_switch == switches::kProfileDirectory;
}

bool ContainsNonFastStartFlag(const base::CommandLine& command_line) {
const base::CommandLine::SwitchMap& switches = command_line.GetSwitches();
if (switches.size() > base::size(kFastStartSwitches))
if (switches.size() > 1)
return true;
for (base::CommandLine::SwitchMap::const_iterator it = switches.begin();
it != switches.end(); ++it) {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
if (first_run::IsChromeFirstRun()) {
if (!parsed_command_line().HasSwitch(switches::kApp) &&
!parsed_command_line().HasSwitch(switches::kAppId) &&
!parsed_command_line().HasSwitch(switches::kShowAppList)) {
!parsed_command_line().HasSwitch(switches::kAppId)) {
AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs);
}

Expand Down
13 changes: 2 additions & 11 deletions chrome/browser/extensions/chrome_process_manager_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,8 @@ bool ChromeProcessManagerDelegate::DeferCreatingStartupBackgroundHosts(
// Background hosts will be loaded later via OnProfileAdded.
// http://crbug.com/222473
// Unit tests may not have a profile manager.
if (g_browser_process->profile_manager() &&
!g_browser_process->profile_manager()->IsValidProfile(profile)) {
return true;
}

// There are no browser windows open and the browser process was
// started to show the app launcher. Background hosts will be loaded later
// via OnBrowserAdded(). http://crbug.com/178260
return chrome::GetBrowserCount(profile) == 0 &&
base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kShowAppList);
return (g_browser_process->profile_manager() &&
!g_browser_process->profile_manager()->IsValidProfile(profile));
}

void ChromeProcessManagerDelegate::OnBrowserAdded(Browser* browser) {
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/lifetime/switch_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ constexpr const char* kSwitchesToRemoveOnAutorestart[] = {
switches::kMakeDefaultBrowser,
switches::kNoStartupWindow,
switches::kRestoreLastSession,
switches::kShowAppList,
switches::kWinJumplistAction};

} // namespace
Expand Down
21 changes: 0 additions & 21 deletions chrome/browser/shell_integration_linux_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,27 +463,6 @@ TEST(ShellIntegrationTest, GetDesktopFileContents) {
}
}

TEST(ShellIntegrationTest, GetDesktopFileContentsAppList) {
const base::FilePath kChromeExePath("/opt/google/chrome/google-chrome");
base::CommandLine command_line(kChromeExePath);
command_line.AppendSwitch("--show-app-list");
EXPECT_EQ(
"#!/usr/bin/env xdg-open\n"
"[Desktop Entry]\n"
"Version=1.0\n"
"Terminal=false\n"
"Type=Application\n"
"Name=Chrome App Launcher\n"
"Exec=/opt/google/chrome/google-chrome --show-app-list\n"
"Icon=chrome_app_list\n"
"Categories=Network;WebBrowser;\n"
"StartupWMClass=chrome-app-list\n",
GetDesktopFileContentsForCommand(
command_line, "chrome-app-list", GURL(),
base::ASCIIToUTF16("Chrome App Launcher"), "chrome_app_list",
"Network;WebBrowser;", "", false));
}

TEST(ShellIntegrationTest, GetDirectoryFileContents) {
const struct {
const char* const title;
Expand Down
9 changes: 0 additions & 9 deletions chrome/browser/shell_integration_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ base::string16 GetProfileIdFromPath(const base::FilePath& profile_path) {
return profile_id;
}

base::string16 GetAppListAppName() {
static const base::char16 kAppListAppNameSuffix[] = L"AppList";
base::string16 app_name(install_static::GetBaseAppId());
app_name.append(kAppListAppNameSuffix);
return app_name;
}

// Gets expected app id for given Chrome (based on |command_line| and
// |is_per_user_install|).
base::string16 GetExpectedAppId(const base::CommandLine& command_line,
Expand Down Expand Up @@ -137,8 +130,6 @@ base::string16 GetExpectedAppId(const base::CommandLine& command_line,
} else if (command_line.HasSwitch(switches::kAppId)) {
app_name = base::UTF8ToUTF16(web_app::GenerateApplicationNameFromAppId(
command_line.GetSwitchValueASCII(switches::kAppId)));
} else if (command_line.HasSwitch(switches::kShowAppList)) {
app_name = GetAppListAppName();
} else {
app_name = ShellUtil::GetBrowserModelId(is_per_user_install);
}
Expand Down
3 changes: 0 additions & 3 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,6 @@ const char kSavePageAsMHTML[] = "save-page-as-mhtml";
// Sets the Reporting API delay to under a second to allow much quicker reports.
const char kShortReportingDelay[] = "short-reporting-delay";

// If true the app list will be shown.
const char kShowAppList[] = "show-app-list";

// Does not show an infobar when an extension attaches to a page using
// chrome.debugger page. Required to attach to extension background pages.
const char kSilentDebuggerExtensionAPI[] = "silent-debugger-extension-api";
Expand Down
1 change: 0 additions & 1 deletion chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ extern const char kRemoteDebuggingTargets[];
extern const char kRestoreLastSession[];
extern const char kSavePageAsMHTML[];
extern const char kShortReportingDelay[];
extern const char kShowAppList[];
extern const char kSilentDebuggerExtensionAPI[];
extern const char kSilentLaunch[];
extern const char kSimulateCriticalUpdate[];
Expand Down
1 change: 0 additions & 1 deletion chrome/installer/util/shell_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,6 @@ bool ShortcutOpListOrRemoveUnknownArgs(
const char* const kept_switches[] = {
switches::kApp,
switches::kAppId,
switches::kShowAppList,
switches::kProfileDirectory,
};
base::CommandLine desired_args(base::CommandLine::NO_PROGRAM);
Expand Down
10 changes: 6 additions & 4 deletions chrome/installer/util/shell_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,10 @@ TEST_F(ShellUtilShortcutTest, ClearShortcutArguments) {
ShellUtil::ShortcutProperties expected_properties3(test_properties_);

// Shortcut 4: targets "chrome.exe"; has both unknown and known arguments.
const base::string16 kKnownArg = L"--app-id";
const base::string16 kExpectedArgs = L"foo.com " + kKnownArg;
test_properties_.set_shortcut_name(L"Chrome 4");
test_properties_.set_arguments(L"foo.com --show-app-list");
test_properties_.set_arguments(kExpectedArgs);
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_,
ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
Expand All @@ -675,7 +677,7 @@ TEST_F(ShellUtilShortcutTest, ClearShortcutArguments) {
EXPECT_EQ(shortcut3_path, shortcut3.first);
EXPECT_EQ(L"foo.com", shortcut3.second);
EXPECT_EQ(shortcut4_path, shortcut4.first);
EXPECT_EQ(L"foo.com --show-app-list", shortcut4.second);
EXPECT_EQ(kExpectedArgs, shortcut4.second);

// Clear shortcuts.
shortcuts.clear();
Expand All @@ -690,7 +692,7 @@ TEST_F(ShellUtilShortcutTest, ClearShortcutArguments) {
EXPECT_EQ(shortcut3_path, shortcut3.first);
EXPECT_EQ(L"foo.com", shortcut3.second);
EXPECT_EQ(shortcut4_path, shortcut4.first);
EXPECT_EQ(L"foo.com --show-app-list", shortcut4.second);
EXPECT_EQ(kExpectedArgs, shortcut4.second);

ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
expected_properties1);
Expand All @@ -699,7 +701,7 @@ TEST_F(ShellUtilShortcutTest, ClearShortcutArguments) {
expected_properties3.set_arguments(base::string16());
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
expected_properties3);
expected_properties4.set_arguments(L"--show-app-list");
expected_properties4.set_arguments(kKnownArg);
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
expected_properties4);
}
Expand Down

0 comments on commit d6fec8a

Please sign in to comment.