blob: fe8363b8b620881a43ca2bfd31425fbfe19eca50 [file] [log] [blame]
Matt Reichhoff405469e2023-07-28 20:07:301// Copyright 2023 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/plus_addresses/features.h"
Kirubel Aklilue230cc952023-09-14 17:28:456
Matt Reichhoff405469e2023-07-28 20:07:307#include "base/feature_list.h"
Kirubel Aklilue230cc952023-09-14 17:28:458#include "base/time/time.h"
Matt Reichhoff405469e2023-07-28 20:07:309
Jan Keitel131cf262024-02-19 11:08:1610namespace plus_addresses::features {
Jan Keitel6ee49f42024-03-04 10:27:3511
12namespace {
13
Jan Keitel6ee49f42024-03-04 10:27:3514constexpr char kEnterprisePlusAddressOAuthScopeName[] = "oauth-scope";
15constexpr char kEnterprisePlusAddressServerUrlName[] = "server-url";
Jan Keitel6ee49f42024-03-04 10:27:3516constexpr char kPlusAddressManagementUrlName[] = "manage-url";
Timofey Chudakov36453fe2024-07-02 09:53:1317constexpr char kPlusAddressLearnMoreUrlName[] = "learn-more";
Jan Keitel2ffd4b72024-10-16 15:05:4618constexpr char kPlusAddressRequestTimeoutName[] = "request-timeout";
Jan Keitel6ee49f42024-03-04 10:27:3519
20} // namespace
21
Jan Keitelfc0e5f22024-07-25 11:53:3722#if BUILDFLAG(IS_ANDROID)
Timofey Chudakov4cb442f2024-10-14 14:44:3223// When enabled, the user is shown the GMS core plus address management activity
24// instead of the web page in a Chrome custom tab.
25BASE_FEATURE(kPlusAddressAndroidOpenGmsCoreManagementPage,
26 "PlusAddressAndroidOpenGmsCoreManagementPage",
27 base::FEATURE_DISABLED_BY_DEFAULT);
Jan Keitelfc0e5f22024-07-25 11:53:3728#endif // BUILDFLAG(IS_ANDROID)
29
Matt Reichhoff405469e2023-07-28 20:07:3030// Controls the enabled/disabled state of the experimental feature.
Norge Vizcay5414f6222024-04-12 12:44:3431BASE_FEATURE(kPlusAddressesEnabled,
Matt Reichhoff405469e2023-07-28 20:07:3032 "PlusAddressesEnabled",
33 base::FEATURE_DISABLED_BY_DEFAULT);
Matt Reichhoff13722ea2023-08-14 17:47:4534
Matt Reichhoffe899e402023-08-23 13:06:0635const base::FeatureParam<std::string> kEnterprisePlusAddressOAuthScope{
Norge Vizcay5414f6222024-04-12 12:44:3436 &kPlusAddressesEnabled, kEnterprisePlusAddressOAuthScopeName, ""};
Kirubel Aklilua7561bfb2023-08-24 19:00:2137const base::FeatureParam<std::string> kEnterprisePlusAddressServerUrl{
Norge Vizcay5414f6222024-04-12 12:44:3438 &kPlusAddressesEnabled, kEnterprisePlusAddressServerUrlName, ""};
Matt Reichhoff3b45f6d2023-09-29 02:56:5439const base::FeatureParam<std::string> kPlusAddressManagementUrl{
Norge Vizcay5414f6222024-04-12 12:44:3440 &kPlusAddressesEnabled, kPlusAddressManagementUrlName, ""};
Timofey Chudakov36453fe2024-07-02 09:53:1341const base::FeatureParam<std::string> kPlusAddressLearnMoreUrl{
42 &kPlusAddressesEnabled, kPlusAddressLearnMoreUrlName, ""};
Jan Keitel2ffd4b72024-10-16 15:05:4643const base::FeatureParam<base::TimeDelta> kPlusAddressRequestTimeout{
44 &kPlusAddressesEnabled, kPlusAddressRequestTimeoutName, base::Seconds(5)};
Mina Prapakamold092fe822023-12-07 00:07:1845
Norge Vizcay57c0ac72024-04-26 10:45:1546// When enabled, plus addresses are supported within the context menu.
Jan Keitel6ee49f42024-03-04 10:27:3547BASE_FEATURE(kPlusAddressFallbackFromContextMenu,
48 "PlusAddressFallbackFromContextMenu",
49 base::FEATURE_DISABLED_BY_DEFAULT);
50
Norge Vizcay1d4f70b2024-09-17 16:37:0251// When enabled, if the user has an existing plus address for the current
52// domain, address profile suggestions will be updated to reflect the plus
53// address email instead of the stored one. Note that only profile emails
54// matching the user's GAIA account will be replaced.
55BASE_FEATURE(kPlusAddressFullFormFill,
56 "PlusAddressFullFormFill",
57 base::FEATURE_DISABLED_BY_DEFAULT);
58
Jan Keitel2960c632024-07-31 06:25:1959// When enabled, plus address creation is offered on all email fields that are
60// not a username field - even if they are on a login form or a change password
61// form.
62// Intended as a killswitch to protect against unexpected behavior.
63// TODO: crbug.com/355398505 - clean up.
64BASE_FEATURE(kPlusAddressOfferCreationOnAllNonUsernameFields,
65 "PlusAddressOfferCreationOnAllNonUsernameFields",
66 base::FEATURE_ENABLED_BY_DEFAULT);
67
Jan Keitela2132342024-10-11 18:22:0468// When enabled, we check whether the server response to a Create call returned
69// information about existing profiles and return those as the parsing result.
70BASE_FEATURE(kPlusAddressParseExistingProfilesFromCreateResponse,
71 "PlusAddressParseExistingProfilesFromCreateResponse",
72 base::FEATURE_ENABLED_BY_DEFAULT);
73
Jan Keitelb22832b2024-08-06 14:36:5074// When enabled, plus addresses are preallocated to avoid having to query the
75// server for every reserve call.
76BASE_FEATURE(kPlusAddressPreallocation,
77 "PlusAddressPreallocation",
78 base::FEATURE_DISABLED_BY_DEFAULT);
79
80// The minimum number of locally stored pre-allocated plus addresses. If the
81// number slips below this threshold, more are requested.
82extern const base::FeatureParam<int> kPlusAddressPreallocationMinimumSize(
83 &kPlusAddressPreallocation,
84 "minimum-size",
85 10);
86
Karol Sygietfb2fb1d2025-01-31 17:31:2787// When enabled, focusing on a username field will show plus address suggestion
88// alongside the autocomplete suggestions.
89// TODO(crbug.com/360791229): Remove when launched.
90BASE_FEATURE(kPlusAddressSuggestionsOnUsernameFields,
91 "PlusAddressSuggestionsOnUsernameFields",
92 base::FEATURE_DISABLED_BY_DEFAULT);
93
Jan Keitel131cf262024-02-19 11:08:1694} // namespace plus_addresses::features