123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- --- a/chrome/browser/ui/tabs/tab_strip_model.cc
- +++ b/chrome/browser/ui/tabs/tab_strip_model.cc
- @@ -11,6 +11,7 @@
- #include <unordered_map>
- #include <utility>
-
- +#include "base/command_line.h"
- #include "base/containers/adapters.h"
- #include "base/containers/contains.h"
- #include "base/containers/flat_map.h"
- @@ -1910,6 +1911,10 @@ void TabStripModel::CloseTabs(base::span
- return;
- }
-
- + const std::string flag_value = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("close-window-with-last-tab");
- + if (flag_value == "never" && !closing_all_ && static_cast<int>(filtered_items.size()) == count())
- + delegate()->AddTabAt(GURL(), -1, true);
- +
- const bool closing_all = static_cast<int>(filtered_items.size()) == count();
- base::WeakPtr<TabStripModel> ref = weak_factory_.GetWeakPtr();
- if (closing_all) {
- --- a/chrome/browser/ungoogled_flag_choices.h
- +++ b/chrome/browser/ungoogled_flag_choices.h
- @@ -55,4 +55,10 @@ const FeatureEntry::Choice kOmniboxAutoc
- "omnibox-autocomplete-filtering",
- "search-bookmarks-chrome"},
- };
- +const FeatureEntry::Choice kCloseWindowWithLastTab[] = {
- + {flags_ui::kGenericExperimentChoiceDefault, "", ""},
- + {"Never",
- + "close-window-with-last-tab",
- + "never"},
- +};
- #endif // CHROME_BROWSER_UNGOOGLED_FLAG_CHOICES_H_
- --- a/chrome/browser/ungoogled_flag_entries.h
- +++ b/chrome/browser/ungoogled_flag_entries.h
- @@ -44,4 +44,8 @@
- "Omnibox Autocomplete Filtering",
- "Restrict omnibox autocomplete results to a combination of search suggestions (if enabled), bookmarks, and internal chrome pages. ungoogled-chromium flag.",
- kOsAll, MULTI_VALUE_TYPE(kOmniboxAutocompleteFiltering)},
- + {"close-window-with-last-tab",
- + "Close window with last tab",
- + "Determines whether a window should close once the last tab is closed. ungoogled-chromium flag.",
- + kOsDesktop, MULTI_VALUE_TYPE(kCloseWindowWithLastTab)},
- #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
|