setting default flags

674 views
Skip to first unread message

Evan Stade

unread,
Aug 5, 2011, 3:12:56 PM8/5/11
to Chromium-dev
Hi all,

is there a way to set a flag as 'on by default' for desktop chrome? (I know this is possible for chromeos by editing the startup script.) The idea is that I want to enable a new feature that is hidden behind a flag by simply flipping a switch somewhere, instead of inverting the value of the flag, then going through every point in the code that checks that flag and inverting its logic. If not, perhaps we can add something to browser_main that modifies the current command line, like about:flags does. Maybe even better would be to just to check the about:flags box by default, but still allow a user to disable it.

-- Evan Stade

Nico Weber

unread,
Aug 5, 2011, 3:15:25 PM8/5/11
to est...@chromium.org, Chromium-dev
On Fri, Aug 5, 2011 at 12:12 PM, Evan Stade <est...@chromium.org> wrote:
> Hi all,
> is there a way to set a flag as 'on by default' for desktop chrome? (I know
> this is possible for chromeos by editing the startup script.) The idea is
> that I want to enable a new feature that is hidden behind a flag by simply
> flipping a switch somewhere, instead of inverting the value of the flag,
> then going through every point in the code that checks that flag

Ideally there should be a single function IsFeatureEnabled() which
checks the flag, and then you just have to change this single
function. That's how I did this for all the features that went from
off-by-default to on-by-default. Is this not feasible in your case?

Nico

> and
> inverting its logic. If not, perhaps we can add something to browser_main
> that modifies the current command line, like about:flags does. Maybe even
> better would be to just to check the about:flags box by default, but still
> allow a user to disable it.
>
> -- Evan Stade
>

> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
>

Evan Martin

unread,
Aug 5, 2011, 3:15:45 PM8/5/11
to est...@chromium.org, Chromium-dev
On Fri, Aug 5, 2011 at 12:12 PM, Evan Stade <est...@chromium.org> wrote:

In some places I've seen a refactoring like:

bool FoobarEnabled() {
// old code: return ...GetSwitch(FoobarEnabled);
// new code: return !...GetSwitch(FoobarDisabled);
}

That way the call sites don't need to be changed when you change
between these behaviors.

Marc-Andre Decoste

unread,
Aug 5, 2011, 3:16:23 PM8/5/11
to est...@chromium.org, Chromium-dev
Can't you use SINGLE_VALUE_TYPE_AND_VALUE, to set your initial value in the kExperiments array?

--

Evan Stade

unread,
Aug 5, 2011, 4:32:31 PM8/5/11
to Marc-Andre Decoste, Chromium-dev
> Ideally there should be a single function IsFeatureEnabled() which
> checks the flag, and then you just have to change this single
> function. That's how I did this for all the features that went from
> off-by-default to on-by-default. Is this not feasible in your case?

I guess that's a good way, although it doesn't allow users to disable the feature very easily unless I add a "Disable new feature" entry to about flags.

On Fri, Aug 5, 2011 at 12:16 PM, Marc-Andre Decoste <m...@chromium.org> wrote:
Can't you use SINGLE_VALUE_TYPE_AND_VALUE, to set your initial value in the kExperiments array?

this is a switch without a value (i.e. --foo-bar, not --foo-bar="baz")
Reply all
Reply to author
Forward
0 new messages