[EnterprisePolicy] Migrate policies to AutofillSettings. [chromium/src : main]

0 views
Skip to first unread message

gwsq (Gerrit)

unread,
Jun 22, 2026, 1:15:14 PM (2 days ago) Jun 22
to Luchen Peng, Enterprise Policy Reviews, Nicolas Ouellet-Payeur, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
Attention needed from Christoph Schwering and Nicolas Ouellet-Payeur

Message from gwsq

Reviewer source(s):
nico...@chromium.org is from context(chrome/enterprise/gwsq/enterprise-policy-review.gwsq)

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
  • Nicolas Ouellet-Payeur
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
Gerrit-Change-Number: 7958598
Gerrit-PatchSet: 11
Gerrit-Owner: Luchen Peng <luche...@google.com>
Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
Gerrit-Reviewer: Luchen Peng <luche...@google.com>
Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
Gerrit-CC: gwsq
Gerrit-Attention: Nicolas Ouellet-Payeur <nico...@chromium.org>
Gerrit-Attention: Christoph Schwering <schw...@google.com>
Gerrit-Comment-Date: Mon, 22 Jun 2026 17:14:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Nicolas Ouellet-Payeur (Gerrit)

unread,
Jun 22, 2026, 2:25:38 PM (2 days ago) Jun 22
to Luchen Peng, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
Attention needed from Christoph Schwering and Luchen Peng

Nicolas Ouellet-Payeur added 7 comments

File chrome/browser/policy/configuration_policy_handler_list_factory.cc
Line 2625, Patchset 11 (Latest): // Deprecate legacy boolean policies AutofillAddressEnabled and
// AutofillCreditCardEnabled in favor of the unified AutofillSettings list
// policy (N-to-1 migration). If AutofillSettings is unset, legacy disabled
// booleans are synthesized into global wildcard block rules ('*') inside
// autofill::prefs::kAutofillTypesBlocked.
Nicolas Ouellet-Payeur . unresolved

Should this comment go near the LegacyAutofillSettingsMigrationPolicyHandler class definition?

Line 2631, Patchset 11 (Latest): legacy_autofill_migration;
legacy_autofill_migration.push_back(
std::make_unique<
autofill::LegacyAutofillSettingsMigrationPolicyHandler>());
Nicolas Ouellet-Payeur . unresolved

nit: golf

```cpp
vector<unique_ptr<...>> legacy_autofill_migration = {make_unique<...>()};
```

or inline

Line 2635, Patchset 11 (Latest): handlers->AddHandler(std::make_unique<LegacyPoliciesDeprecatingPolicyHandler>(
Nicolas Ouellet-Payeur . unresolved

To clarify, `AutofillAddressEnabled` and `AutofillCreditCardEnabled` will do *literally nothing* if `AutofillSettings` is configured. I think this is gonna be really confusing for admins

File components/autofill/core/browser/permissions/autofill_policy_handler.cc
Line 72, Patchset 11 (Latest): // Do NOT synthesize legacy list rules if the admin is already using the new
// policy.
if (policies.GetValue(policy::key::kAutofillSettings,
base::Value::Type::LIST)) {
return;
}
Nicolas Ouellet-Payeur . unresolved

I don't think this can ever happen? Because of how `LegacyPoliciesDeprecatingPolicyHandler` works

Line 80, Patchset 11 (Latest): if (address_enabled && address_enabled->is_bool() &&
!address_enabled->GetBool()) {
Nicolas Ouellet-Payeur . unresolved

Code is repeated 2 times, this could be a helper function

```cpp
base::DictValue CreateMigratedRule(const char* blocked_type) {
return ...;
}
```
Line 84, Patchset 11 (Latest): base::DictValue rule;
rule.Set("url_pattern", "*");
rule.Set("blocked_types", std::move(blocked_types));
Nicolas Ouellet-Payeur . unresolved

nit: golf

```cpp
base::DictValue rule = base::DictValue()
.Set("url_pattern", "*")
.Set("blocked_types", base::ListValue().Append("contact_info"));
```

and/or inline.

Line 91, Patchset 11 (Latest): blocked_types.Append("payments");
Nicolas Ouellet-Payeur . unresolved

Would it make sense to create a single rule with 1-2 blocked_types, instead of 2 rules with 1 blocked_type each? I guess it doesn't really matter

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
  • Luchen Peng
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
    Gerrit-Change-Number: 7958598
    Gerrit-PatchSet: 11
    Gerrit-Owner: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Luchen Peng <luche...@google.com>
    Gerrit-Attention: Christoph Schwering <schw...@google.com>
    Gerrit-Comment-Date: Mon, 22 Jun 2026 18:25:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Luchen Peng (Gerrit)

    unread,
    Jun 23, 2026, 11:02:44 AM (yesterday) Jun 23
    to Enterprise Policy Reviews, Nicolas Ouellet-Payeur, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
    Attention needed from Christoph Schwering and Nicolas Ouellet-Payeur

    Luchen Peng added 7 comments

    File chrome/browser/policy/configuration_policy_handler_list_factory.cc
    Line 2625, Patchset 11: // Deprecate legacy boolean policies AutofillAddressEnabled and

    // AutofillCreditCardEnabled in favor of the unified AutofillSettings list
    // policy (N-to-1 migration). If AutofillSettings is unset, legacy disabled
    // booleans are synthesized into global wildcard block rules ('*') inside
    // autofill::prefs::kAutofillTypesBlocked.
    Nicolas Ouellet-Payeur . resolved

    Should this comment go near the LegacyAutofillSettingsMigrationPolicyHandler class definition?

    Luchen Peng

    Sure, Moved this to autofill_policy_handler.h

    Line 2631, Patchset 11: legacy_autofill_migration;

    legacy_autofill_migration.push_back(
    std::make_unique<
    autofill::LegacyAutofillSettingsMigrationPolicyHandler>());
    Nicolas Ouellet-Payeur . unresolved

    nit: golf

    ```cpp
    vector<unique_ptr<...>> legacy_autofill_migration = {make_unique<...>()};
    ```

    or inline

    Luchen Peng

    I tried `vector<unique_ptr<...>> legacy_autofill_migration = {make_unique<...>()};` but it gives a compile error. Because std::unique_ptr is move-only and std::initializer_list only provides const access (forcing a deleted copy-constructor call), { make_unique<...>() } doesn't compile.

    ```
    ../../third_party/libc++/src/include/__vector/vector.h:273:5: note: in instantiation of function template specialization 'std::vector<std::unique_ptr<policy::ConfigurationPolicyHandler>>::__init_with_size<const std::unique_ptr<policy::ConfigurationPolicyHandler> *, const std::unique_ptr<policy::ConfigurationPolicyHandler> *>' requested here
    273 | __init_with_size(__il.begin(), __il.end(), __il.size());
    | ^
    ../../chrome/browser/policy/configuration_policy_handler_list_factory.cc:2638:35: note: in instantiation of member function 'std::vector<std::unique_ptr<policy::ConfigurationPolicyHandler>>::vector' requested here
    2638 | legacy_autofill_migration = {
    | ^
    ../../third_party/libc++/src/include/__memory/construct_at.h:43:58: note: candidate template ignored: substitution failure [with _Tp = std::unique_ptr<policy::ConfigurationPolicyHandler>, _Args = <const std::unique_ptr<policy::ConfigurationPolicyHandler> &>]: call to implicitly-deleted copy constructor of 'std::unique_ptr<policy::ConfigurationPolicyHandler>'
    42 | template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
    | ~~~
    43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __construct_at(_Tp* __location, _Args&&... __args) {
    | ^
    1 error generated.

    ```

    Line 2635, Patchset 11: handlers->AddHandler(std::make_unique<LegacyPoliciesDeprecatingPolicyHandler>(
    Nicolas Ouellet-Payeur . unresolved

    To clarify, `AutofillAddressEnabled` and `AutofillCreditCardEnabled` will do *literally nothing* if `AutofillSettings` is configured. I think this is gonna be really confusing for admins

    Luchen Peng

    The goal is to replace `AutofillAddressEnabled` and `AutofillCreditCardEnabled` with the new `AutofillSettings` policy. I'm not sure what is the usual convention for enterprise policy for migration?

    I can also keep the behavior for `AutofillAddressEnabled` and `AutofillCreditCardEnabled` in addition to `AutofillSettings`, but then admins will have three settings to manage and keep in sync.

    File components/autofill/core/browser/permissions/autofill_policy_handler.cc
    Line 72, Patchset 11: // Do NOT synthesize legacy list rules if the admin is already using the new

    // policy.
    if (policies.GetValue(policy::key::kAutofillSettings,
    base::Value::Type::LIST)) {
    return;
    }
    Nicolas Ouellet-Payeur . resolved

    I don't think this can ever happen? Because of how `LegacyPoliciesDeprecatingPolicyHandler` works

    Luchen Peng

    You are right, this shouldn't happen, removed it.

    Line 80, Patchset 11: if (address_enabled && address_enabled->is_bool() &&
    !address_enabled->GetBool()) {
    Nicolas Ouellet-Payeur . resolved

    Code is repeated 2 times, this could be a helper function

    ```cpp
    base::DictValue CreateMigratedRule(const char* blocked_type) {
    return ...;
    }
    ```
    Luchen Peng

    Created helper method IsPolicySetToFalse() to check for both address and credit card policies.

    Line 84, Patchset 11: base::DictValue rule;

    rule.Set("url_pattern", "*");
    rule.Set("blocked_types", std::move(blocked_types));
    Nicolas Ouellet-Payeur . resolved

    nit: golf

    ```cpp
    base::DictValue rule = base::DictValue()
    .Set("url_pattern", "*")
    .Set("blocked_types", base::ListValue().Append("contact_info"));
    ```

    and/or inline.

    Luchen Peng

    Done

    Line 91, Patchset 11: blocked_types.Append("payments");
    Nicolas Ouellet-Payeur . resolved

    Would it make sense to create a single rule with 1-2 blocked_types, instead of 2 rules with 1 blocked_type each? I guess it doesn't really matter

    Luchen Peng

    Makes sense to have it with 1 rule and 1-2 blocked_types. Update the logic that way.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christoph Schwering
    • Nicolas Ouellet-Payeur
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
    Gerrit-Change-Number: 7958598
    Gerrit-PatchSet: 14
    Gerrit-Owner: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Nicolas Ouellet-Payeur <nico...@chromium.org>
    Gerrit-Attention: Christoph Schwering <schw...@google.com>
    Gerrit-Comment-Date: Tue, 23 Jun 2026 15:02:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nicolas Ouellet-Payeur <nico...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nicolas Ouellet-Payeur (Gerrit)

    unread,
    Jun 23, 2026, 11:22:08 AM (yesterday) Jun 23
    to Luchen Peng, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
    Attention needed from Christoph Schwering and Luchen Peng

    Nicolas Ouellet-Payeur added 2 comments

    File chrome/browser/policy/configuration_policy_handler_list_factory.cc
    Line 2631, Patchset 11: legacy_autofill_migration;
    legacy_autofill_migration.push_back(
    std::make_unique<
    autofill::LegacyAutofillSettingsMigrationPolicyHandler>());
    Nicolas Ouellet-Payeur . resolved

    nit: golf

    ```cpp
    vector<unique_ptr<...>> legacy_autofill_migration = {make_unique<...>()};
    ```

    or inline

    Luchen Peng

    I tried `vector<unique_ptr<...>> legacy_autofill_migration = {make_unique<...>()};` but it gives a compile error. Because std::unique_ptr is move-only and std::initializer_list only provides const access (forcing a deleted copy-constructor call), { make_unique<...>() } doesn't compile.

    ```
    ../../third_party/libc++/src/include/__vector/vector.h:273:5: note: in instantiation of function template specialization 'std::vector<std::unique_ptr<policy::ConfigurationPolicyHandler>>::__init_with_size<const std::unique_ptr<policy::ConfigurationPolicyHandler> *, const std::unique_ptr<policy::ConfigurationPolicyHandler> *>' requested here
    273 | __init_with_size(__il.begin(), __il.end(), __il.size());
    | ^
    ../../chrome/browser/policy/configuration_policy_handler_list_factory.cc:2638:35: note: in instantiation of member function 'std::vector<std::unique_ptr<policy::ConfigurationPolicyHandler>>::vector' requested here
    2638 | legacy_autofill_migration = {
    | ^
    ../../third_party/libc++/src/include/__memory/construct_at.h:43:58: note: candidate template ignored: substitution failure [with _Tp = std::unique_ptr<policy::ConfigurationPolicyHandler>, _Args = <const std::unique_ptr<policy::ConfigurationPolicyHandler> &>]: call to implicitly-deleted copy constructor of 'std::unique_ptr<policy::ConfigurationPolicyHandler>'
    42 | template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
    | ~~~
    43 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __construct_at(_Tp* __location, _Args&&... __args) {
    | ^
    1 error generated.

    ```

    Nicolas Ouellet-Payeur

    Gotcha. I hate C++ sometimes

    Line 2635, Patchset 11: handlers->AddHandler(std::make_unique<LegacyPoliciesDeprecatingPolicyHandler>(
    Nicolas Ouellet-Payeur . unresolved

    To clarify, `AutofillAddressEnabled` and `AutofillCreditCardEnabled` will do *literally nothing* if `AutofillSettings` is configured. I think this is gonna be really confusing for admins

    Luchen Peng

    The goal is to replace `AutofillAddressEnabled` and `AutofillCreditCardEnabled` with the new `AutofillSettings` policy. I'm not sure what is the usual convention for enterprise policy for migration?

    I can also keep the behavior for `AutofillAddressEnabled` and `AutofillCreditCardEnabled` in addition to `AutofillSettings`, but then admins will have three settings to manage and keep in sync.

    Nicolas Ouellet-Payeur

    The common solution would be to deprecate Autofill{Address,Card}Enabled but keep them working (your CL does this). More importantly, if both {Address,Card}Enabled *and* AutofillSettings are both set, they could "merge" in a way that makes sense (your CL doesn't do this right now).

    For example, look at ExtensionInstall{Force,Allow,Block}list vs. ExtensionSettings. If you set them, the force/allow/blocklist effectively gets merged into the ExtensionSettings dict. This is the more common pattern, and it's less confusing for admins.

    I think(?) you could do something similar here: let the admin define rules in AutofillSettings, and if they set Autofill{Address,Card}Enabled we *also* add a wildcard rule in `kAutofillTypesBlocked`. Or maybe that doesn't make sense for this policy?

    (for context: `LegacyPoliciesDeprecatingPolicyHandler` is useful when the policies can't be combined, so it doesn't make sense to set both. e.g. SigninEnabled (bool) vs. BrowserSignin (enum: disabled, enabled, forced) we can't really reconcile conflicting values. So when you have `SigninEnabled=false` and `BrowserSignin=enabled`, BrowserSignin always "wins" the conflict)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christoph Schwering
    • Luchen Peng
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
    Gerrit-Change-Number: 7958598
    Gerrit-PatchSet: 14
    Gerrit-Owner: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Luchen Peng <luche...@google.com>
    Gerrit-Attention: Christoph Schwering <schw...@google.com>
    Gerrit-Comment-Date: Tue, 23 Jun 2026 15:21:53 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Luchen Peng <luche...@google.com>
    Comment-In-Reply-To: Nicolas Ouellet-Payeur <nico...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Luchen Peng (Gerrit)

    unread,
    Jun 23, 2026, 1:36:28 PM (yesterday) Jun 23
    to Enterprise Policy Reviews, Nicolas Ouellet-Payeur, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
    Attention needed from Christoph Schwering and Nicolas Ouellet-Payeur

    Luchen Peng added 1 comment

    File chrome/browser/policy/configuration_policy_handler_list_factory.cc
    Line 2635, Patchset 11: handlers->AddHandler(std::make_unique<LegacyPoliciesDeprecatingPolicyHandler>(
    Nicolas Ouellet-Payeur . unresolved

    To clarify, `AutofillAddressEnabled` and `AutofillCreditCardEnabled` will do *literally nothing* if `AutofillSettings` is configured. I think this is gonna be really confusing for admins

    Luchen Peng

    The goal is to replace `AutofillAddressEnabled` and `AutofillCreditCardEnabled` with the new `AutofillSettings` policy. I'm not sure what is the usual convention for enterprise policy for migration?

    I can also keep the behavior for `AutofillAddressEnabled` and `AutofillCreditCardEnabled` in addition to `AutofillSettings`, but then admins will have three settings to manage and keep in sync.

    Nicolas Ouellet-Payeur

    The common solution would be to deprecate Autofill{Address,Card}Enabled but keep them working (your CL does this). More importantly, if both {Address,Card}Enabled *and* AutofillSettings are both set, they could "merge" in a way that makes sense (your CL doesn't do this right now).

    For example, look at ExtensionInstall{Force,Allow,Block}list vs. ExtensionSettings. If you set them, the force/allow/blocklist effectively gets merged into the ExtensionSettings dict. This is the more common pattern, and it's less confusing for admins.

    I think(?) you could do something similar here: let the admin define rules in AutofillSettings, and if they set Autofill{Address,Card}Enabled we *also* add a wildcard rule in `kAutofillTypesBlocked`. Or maybe that doesn't make sense for this policy?

    (for context: `LegacyPoliciesDeprecatingPolicyHandler` is useful when the policies can't be combined, so it doesn't make sense to set both. e.g. SigninEnabled (bool) vs. BrowserSignin (enum: disabled, enabled, forced) we can't really reconcile conflicting values. So when you have `SigninEnabled=false` and `BrowserSignin=enabled`, BrowserSignin always "wins" the conflict)

    Luchen Peng

    I see, in this case I think merging them makes more sense. When this policy is checked on the client, we match all the rules, so if there are conflict rules, e.g. AutofillAddressEnabled is set to false and in AutofillSettings address is disabled in a specific domain, we would respect the overall address disabled policy. I think this is fine.

    I removed the usage of `LegacyPoliciesDeprecatingPolicyHandler`, I think that is not needed in this case.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christoph Schwering
    • Nicolas Ouellet-Payeur
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
    Gerrit-Change-Number: 7958598
    Gerrit-PatchSet: 16
    Gerrit-Owner: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Luchen Peng <luche...@google.com>
    Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Nicolas Ouellet-Payeur <nico...@chromium.org>
    Gerrit-Attention: Christoph Schwering <schw...@google.com>
    Gerrit-Comment-Date: Tue, 23 Jun 2026 17:36:08 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nicolas Ouellet-Payeur (Gerrit)

    unread,
    Jun 23, 2026, 2:29:24 PM (yesterday) Jun 23
    to Luchen Peng, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
    Attention needed from Christoph Schwering and Luchen Peng

    Nicolas Ouellet-Payeur voted and added 4 comments

    Votes added by Nicolas Ouellet-Payeur

    Code-Review+1

    4 comments

    Patchset-level comments
    File-level comment, Patchset 16 (Latest):
    Nicolas Ouellet-Payeur . resolved

    LGTM w/ nits

    File chrome/browser/policy/configuration_policy_handler_list_factory.cc
    Line 2635, Patchset 11: handlers->AddHandler(std::make_unique<LegacyPoliciesDeprecatingPolicyHandler>(
    Nicolas Ouellet-Payeur . resolved

    To clarify, `AutofillAddressEnabled` and `AutofillCreditCardEnabled` will do *literally nothing* if `AutofillSettings` is configured. I think this is gonna be really confusing for admins

    Luchen Peng

    The goal is to replace `AutofillAddressEnabled` and `AutofillCreditCardEnabled` with the new `AutofillSettings` policy. I'm not sure what is the usual convention for enterprise policy for migration?

    I can also keep the behavior for `AutofillAddressEnabled` and `AutofillCreditCardEnabled` in addition to `AutofillSettings`, but then admins will have three settings to manage and keep in sync.

    Nicolas Ouellet-Payeur

    The common solution would be to deprecate Autofill{Address,Card}Enabled but keep them working (your CL does this). More importantly, if both {Address,Card}Enabled *and* AutofillSettings are both set, they could "merge" in a way that makes sense (your CL doesn't do this right now).

    For example, look at ExtensionInstall{Force,Allow,Block}list vs. ExtensionSettings. If you set them, the force/allow/blocklist effectively gets merged into the ExtensionSettings dict. This is the more common pattern, and it's less confusing for admins.

    I think(?) you could do something similar here: let the admin define rules in AutofillSettings, and if they set Autofill{Address,Card}Enabled we *also* add a wildcard rule in `kAutofillTypesBlocked`. Or maybe that doesn't make sense for this policy?

    (for context: `LegacyPoliciesDeprecatingPolicyHandler` is useful when the policies can't be combined, so it doesn't make sense to set both. e.g. SigninEnabled (bool) vs. BrowserSignin (enum: disabled, enabled, forced) we can't really reconcile conflicting values. So when you have `SigninEnabled=false` and `BrowserSignin=enabled`, BrowserSignin always "wins" the conflict)

    Luchen Peng

    I see, in this case I think merging them makes more sense. When this policy is checked on the client, we match all the rules, so if there are conflict rules, e.g. AutofillAddressEnabled is set to false and in AutofillSettings address is disabled in a specific domain, we would respect the overall address disabled policy. I think this is fine.

    I removed the usage of `LegacyPoliciesDeprecatingPolicyHandler`, I think that is not needed in this case.

    Nicolas Ouellet-Payeur

    Nice, thanks

    File components/autofill/core/browser/permissions/autofill_policy_handler.cc
    Line 69, Patchset 16 (Latest):bool AutofillSettingsPolicyHandler::CheckPolicySettings(
    Nicolas Ouellet-Payeur . unresolved

    It should probably show a warning if the legacy policies aren't the correct type

    Line 121, Patchset 16 (Latest): if (const base::Value* autofill_settings =
    policies.GetValue(policy_name(), base::Value::Type::LIST)) {
    for (const auto& item : autofill_settings->GetList()) {
    merged_rules.Append(item.Clone());
    }
    }
    Nicolas Ouellet-Payeur . unresolved

    You can simplify by removing the guard on lines 107-115:

    ```
    base::ListValue merged_rules;
    if (const base::Value* autofill_settings =
    policies.GetValue(policy_name(), base::Value::Type::LIST)) {
    merged_rules = autofill_settings->GetList().Clone();
    }
    if (!blocked_types.empty()) {
    merged_rules.Append(base::DictValue()
    .Set(kUrlPatternKey, "*")
    .Set(kBlockedTypesKey, std::move(blocked_types)))
    }
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christoph Schwering
    • Luchen Peng
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
      Gerrit-Change-Number: 7958598
      Gerrit-PatchSet: 16
      Gerrit-Owner: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
      Gerrit-Reviewer: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Luchen Peng <luche...@google.com>
      Gerrit-Attention: Christoph Schwering <schw...@google.com>
      Gerrit-Comment-Date: Tue, 23 Jun 2026 18:29:10 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Christoph Schwering (Gerrit)

      unread,
      5:50 AM (17 hours ago) 5:50 AM
      to Luchen Peng, Nicolas Ouellet-Payeur, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
      Attention needed from Luchen Peng

      Christoph Schwering added 4 comments

      Patchset-level comments
      Christoph Schwering . unresolved

      The code looks good to me % the open comments, but perhaps a reviewer of the doc should review this CL.

      File components/autofill/core/browser/permissions/autofill_policy_handler.cc
      Line 107, Patchset 16 (Latest): // If no legacy booleans are disabled, let the validating handler apply
      Christoph Schwering . unresolved

      nit: "boolean policies" or so?

      Line 109, Patchset 16 (Latest): if (blocked_types.empty()) {
      Christoph Schwering . unresolved

      Why is it OK to enter the `if` block if, for example, `kAutofillAddressEnabled` is disabled and `kAutofillCreditCardEnabled` is enabled?

      Line 117, Patchset 16 (Latest): // If legacy booleans are disabled, build the consolidated list
      // directly in memory (configured rules + wildcard block rule) and write to
      Christoph Schwering . unresolved

      nit: join lines

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Luchen Peng
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
      Gerrit-Change-Number: 7958598
      Gerrit-PatchSet: 16
      Gerrit-Owner: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
      Gerrit-Reviewer: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Luchen Peng <luche...@google.com>
      Gerrit-Comment-Date: Wed, 24 Jun 2026 09:50:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Luchen Peng (Gerrit)

      unread,
      10:10 AM (13 hours ago) 10:10 AM
      to Nicolas Ouellet-Payeur, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
      Attention needed from Christoph Schwering

      Luchen Peng voted and added 5 comments

      Votes added by Luchen Peng

      Commit-Queue+1

      5 comments

      File components/autofill/core/browser/permissions/autofill_policy_handler.cc
      Line 69, Patchset 16:bool AutofillSettingsPolicyHandler::CheckPolicySettings(
      Nicolas Ouellet-Payeur . resolved

      It should probably show a warning if the legacy policies aren't the correct type

      Luchen Peng

      Added checks for legacy policy type.

      Line 107, Patchset 16: // If no legacy booleans are disabled, let the validating handler apply
      Christoph Schwering . resolved

      nit: "boolean policies" or so?

      Luchen Peng

      Updated to "boolean policies".

      Line 109, Patchset 16: if (blocked_types.empty()) {
      Christoph Schwering . unresolved

      Why is it OK to enter the `if` block if, for example, `kAutofillAddressEnabled` is disabled and `kAutofillCreditCardEnabled` is enabled?

      Luchen Peng

      No, it is checking both in the previous block, for `legacy_address_enabled` and `legacy_credit_card_enabled`, and appending to the `blocked_types`.

      Line 117, Patchset 16: // If legacy booleans are disabled, build the consolidated list

      // directly in memory (configured rules + wildcard block rule) and write to
      Christoph Schwering . resolved

      nit: join lines

      Luchen Peng

      Done

      Line 121, Patchset 16: if (const base::Value* autofill_settings =

      policies.GetValue(policy_name(), base::Value::Type::LIST)) {
      for (const auto& item : autofill_settings->GetList()) {
      merged_rules.Append(item.Clone());
      }
      }
      Nicolas Ouellet-Payeur . resolved

      You can simplify by removing the guard on lines 107-115:

      ```
      base::ListValue merged_rules;
      if (const base::Value* autofill_settings =
      policies.GetValue(policy_name(), base::Value::Type::LIST)) {
      merged_rules = autofill_settings->GetList().Clone();
      }
      if (!blocked_types.empty()) {
      merged_rules.Append(base::DictValue()
      .Set(kUrlPatternKey, "*")
      .Set(kBlockedTypesKey, std::move(blocked_types)))
      }
      ```
      Luchen Peng

      Updated, thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Christoph Schwering
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
      Gerrit-Change-Number: 7958598
      Gerrit-PatchSet: 17
      Gerrit-Owner: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
      Gerrit-Reviewer: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Christoph Schwering <schw...@google.com>
      Gerrit-Comment-Date: Wed, 24 Jun 2026 14:10:03 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Nicolas Ouellet-Payeur <nico...@chromium.org>
      Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Christoph Schwering (Gerrit)

      unread,
      9:29 PM (2 hours ago) 9:29 PM
      to Luchen Peng, Norge Vizcay, Nicolas Ouellet-Payeur, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org
      Attention needed from Luchen Peng and Norge Vizcay

      Christoph Schwering voted and added 2 comments

      Votes added by Christoph Schwering

      Code-Review+1

      2 comments

      File components/autofill/core/browser/permissions/autofill_policy_handler.cc
      Line 18, Patchset 16:constexpr char kContactInfoBlockedType[] = "contact_info";
      constexpr char kPaymentsBlockedType[] = "payments";
      constexpr char kUrlPatternKey[] = "url_pattern";
      constexpr char kBlockedTypesKey[] = "blocked_types";
      Christoph Schwering . unresolved

      Should we ensure that these are identical to https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/permissions/enterprise_policy/autofill_enterprise_policy_service.cc;l=23;drc=54e68f01b6df87060477349a42b3dc60c83fff2a?

      I think at least documentation would be helpful to understand where those prefs that are written here will be read.

      Line 109, Patchset 16: if (blocked_types.empty()) {
      Christoph Schwering . unresolved

      Why is it OK to enter the `if` block if, for example, `kAutofillAddressEnabled` is disabled and `kAutofillCreditCardEnabled` is enabled?

      Luchen Peng

      No, it is checking both in the previous block, for `legacy_address_enabled` and `legacy_credit_card_enabled`, and appending to the `blocked_types`.

      Christoph Schwering

      I think I got it now: IIUC the `policy::SimpleSchemaValidatingPolicyHandler::ApplyPolicySettings()` call inside the `if` statement is equivalent to the code after the `if` block if `blocked_types` were empty, except that the merging logic in that case would add useless `blocked_types: []` to the pref.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Luchen Peng
      • Norge Vizcay
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ib9197c11e40feb6d900950d3ddca4f49df09ec9b
      Gerrit-Change-Number: 7958598
      Gerrit-PatchSet: 17
      Gerrit-Owner: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
      Gerrit-Reviewer: Luchen Peng <luche...@google.com>
      Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
      Gerrit-Reviewer: Norge Vizcay <viz...@google.com>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Luchen Peng <luche...@google.com>
      Gerrit-Attention: Norge Vizcay <viz...@google.com>
      Gerrit-Comment-Date: Thu, 25 Jun 2026 01:29:30 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Luchen Peng <luche...@google.com>
      Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages