-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flags for existing switches #1687
Add flags for existing switches #1687
Conversation
|
Btw disable WebGL conflicts with this Bromite patch, maybe you can adjust it so I don't need the Bromite patch anymore? |
It would nice if that already had a switch! I've been experimenting with different methods of making the ntp tiles adjustable and I have a couple different solutions I'm testing out. It's not as straightforward as I initially thought!
Both are correct, these are just flags with no code changes which work because the command-line switches already exist. You shouldn't need that patch anymore while using this PR. They are essentially the same thing: const char kDisableWebGL[] = "disable-webgl"; |
i request for this flags |
In that case I wonder whether it is possible to write a script to convert all command line options to flags? I think the differences are just definitions in header files. |
It's possible, but there are a lot of switches available and that would likely make digging through I would like to keep the patch on the smaller side as I mostly intend this to cover just the most often used switches to make things easier for end users that only need a few of them. An argument could be made to remove some of the ones I've included since there may not be many people that utilize them, but that's one of the reasons I made this a draft as I'm interested in seeing what switches other people are using. |
If anyone is interested, I've managed to make Chromium show 25 recent tabs: More tabs in recent
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
@@ -60,7 +60,7 @@
// The maximum number of local recently closed entries (tab or window) to be
// shown in the menu.
-const int kMaxLocalEntries = 8;
+const int kMaxLocalEntries = 25;
// Comparator function for use with std::sort that will sort sessions by
// descending modified_time (i.e., most recent first).
And 128 ntp tiles (it takes a second to render this madness :) ): More NTP tiles
--- a/ui/webui/resources/cr_components/most_visited/most_visited.ts
+++ b/ui/webui/resources/cr_components/most_visited/most_visited.ts
@@ -343,20 +343,19 @@
}
private computeColumnCount_(): number {
- let maxColumns = 3;
+ let maxColumns = 4;
if (this.screenWidth_ === ScreenWidth.WIDE) {
- maxColumns = 5;
+ maxColumns = 16;
} else if (this.screenWidth_ === ScreenWidth.MEDIUM) {
- maxColumns = 4;
+ maxColumns = 10;
}
const shortcutCount = this.tiles_ ? this.tiles_.length : 0;
const canShowAdd = this.maxTiles_ > shortcutCount;
- const tileCount =
- Math.min(this.maxTiles_, shortcutCount + (canShowAdd ? 1 : 0));
- const columnCount = tileCount <= maxColumns ?
- tileCount :
- Math.min(maxColumns, Math.ceil(tileCount / 2));
+ const tileCount = shortcutCount + (canShowAdd ? 1 : 0);
+ const columnCount = Math.ceil(Math.sqrt(tileCount/2)*2) <= maxColumns ?
+ Math.ceil(Math.sqrt(tileCount/2)*2) :
+ maxColumns;
return columnCount || 3;
}
@@ -364,13 +363,14 @@
if (this.columnCount_ === 0) {
return 0;
}
-
const shortcutCount = this.tiles_ ? this.tiles_.length : 0;
- return this.columnCount_ <= shortcutCount ? 2 : 1;
+ const canShowAdd = this.maxTiles_ > shortcutCount;
+ const tileCount = shortcutCount + (canShowAdd ? 1 : 0);
+ return Math.ceil(tileCount/this.columnCount_) || 2;
}
private computeMaxTiles_(): number {
- return this.customLinksEnabled_ ? 10 : 8;
+ return 128;
}
private computeMaxVisibleTiles_(): number {
--- a/components/ntp_tiles/constants.h
+++ b/components/ntp_tiles/constants.h
@@ -16,7 +16,7 @@
extern const size_t kMaxNumMostVisited;
// Maximum number of tiles that can be shown on the NTP.
-const int kMaxNumTiles = 10;
+const int kMaxNumTiles = 128;
} // namespace ntp_tiles
--- a/components/ntp_tiles/constants.cc
+++ b/components/ntp_tiles/constants.cc
@@ -6,10 +6,10 @@
namespace ntp_tiles {
-const size_t kMaxNumCustomLinks = 10;
+const size_t kMaxNumCustomLinks = 128;
// If custom links are enabled, an additional tile may be returned making up to
// kMaxNumCustomLinks custom links including the "Add shortcut" button.
-const size_t kMaxNumMostVisited = 8;
+const size_t kMaxNumMostVisited = 128;
} // namespace ntp_tiles
--- a/components/history/core/browser/top_sites_impl.h
+++ b/components/history/core/browser/top_sites_impl.h
@@ -40,7 +40,7 @@
struct SitesAndQueriesRequest;
// How many top sites to store in the cache.
-static constexpr size_t kTopSitesNumber = 10;
+static constexpr size_t kTopSitesNumber = 128;
// This class allows requests for most visited urls on any thread. All other
// methods must be invoked on the UI thread. All mutations to internal state
|
sorry if this is not related, but is it possible to increase the number of suggestions in the omnibar? for example if I type currently it only shows 6 suggestions as a maximum number 🤔 |
I'm glad you asked :) I ended up with the following: Omnibox autocomplete
--- a/components/omnibox/browser/autocomplete_result.cc
+++ b/components/omnibox/browser/autocomplete_result.cc
@@ -95,8 +95,8 @@
// and 10 on iPad.
constexpr size_t kMaxZeroSuggestMatchesOnIPad = 10;
#else
- constexpr size_t kDefaultMaxAutocompleteMatches = 8;
- constexpr size_t kDefaultMaxZeroSuggestMatches = 8;
+ constexpr size_t kDefaultMaxAutocompleteMatches = 25;
+ constexpr size_t kDefaultMaxZeroSuggestMatches = 25;
#endif
static_assert(kMaxAutocompletePositionValue > kDefaultMaxAutocompleteMatches,
"kMaxAutocompletePositionValue must be larger than the largest "
--- a/components/omnibox/browser/omnibox_field_trial.cc
+++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -269,9 +269,9 @@ void OmniboxFieldTrial::GetDemotionsByType(
size_t OmniboxFieldTrial::GetProviderMaxMatches(
AutocompleteProvider::Type provider) {
- size_t default_max_matches_per_provider = 3;
+ size_t default_max_matches_per_provider = 20;
- std::string param_value = base::GetFieldTrialParamValueByFeature(
+/* std::string param_value = base::GetFieldTrialParamValueByFeature(
omnibox::kUIExperimentMaxAutocompleteMatches,
OmniboxFieldTrial::kUIMaxAutocompleteMatchesByProviderParam);
@@ -295,7 +295,7 @@ size_t OmniboxFieldTrial::GetProviderMaxMatches(
else if (k == provider)
return v;
}
- }
+ }*/
return default_max_matches_per_provider;
} Which is based on https://github.com/bromite/bromite/blob/master/build/patches/Increase-number-of-autocomplete-matches-to-10.patch which is based on #814 (comment) |
i think it would also be good to add support for |
Will this change be integrated into ungoogled-chromium? or will it become a flag I can change? |
I'm applying locally these and some other Bromite patches and they work exceptionally well with ungoogled-chromium and bring some additional value. As such I'm willing to try and merge them when we have resolved the licensing issue as discussed in #1845. Cannot promise anything though. It could be that they only fit in contrib repo, and not here. It could be that it would be very difficult (for me) to refactor them into toggle-able flags and no one would be interested either. |
580aa8d
to
2d41a3c
Compare
I've been sitting on this for too long, but this should be good to go. I've updated the PR to include the low end device mode and WebRTC IP handling policy. We can always add more in the in future if needed. |
I'm not sure if it is possible to convert blink switches into flags also but if possible I would like to see |
I recall experimenting with nested flags a long time ago and this method didn't work them. It should be possible to set up a helper to pass them along. I'll do some more testing later on to see what would work. |
@Ahrotahn Should we merge this PR after updating for new version or would you like to tinker some more? |
It should be fine like this. If I'm able to figure out a clean solution for the nested flags I'll make a new PR to update the patch further. |
2d41a3c
to
3596cd6
Compare
Should we prioritize #2116 then and merge others afterwards? |
So, merging this one next, then? |
Sure, I'll update the others in a bit. |
Awesome! |
Sorry for asking again, but has the licensing issue been worked out yet? I saw that the mentioned PR got merged, if so I can create a new issue to track the progress and it anyone is willing to maintain a patch for. |
Carl granted us permission to keep the original patches we currently have, but we wouldn't be able to include any new ones without working that out unfortunately. |
This PR creates
chrome://flags
entries for existing Chromium switches and features.There have been many previous requests for flags that already exist, albeit only as command-line switches. The most prominent ones are for starting in incognito and removing the tiles on the new tab page. This also helps in situations where adding switches would be difficult, such as on mobile.
The initial entries:
This isn't meant to be an exhaustive list, but I'd like to add the more commonly used/requested ones.
I'll keep this as a draft for a while so everyone has time to add suggestions for other useful entries.