Matt Reichhoff | 405469e | 2023-07-28 20:07:30 | [diff] [blame] | 1 | // 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 Aklilu | e230cc95 | 2023-09-14 17:28:45 | [diff] [blame] | 6 | |
Matt Reichhoff | 405469e | 2023-07-28 20:07:30 | [diff] [blame] | 7 | #include "base/feature_list.h" |
Kirubel Aklilu | e230cc95 | 2023-09-14 17:28:45 | [diff] [blame] | 8 | #include "base/time/time.h" |
Matt Reichhoff | 405469e | 2023-07-28 20:07:30 | [diff] [blame] | 9 | |
Jan Keitel | 131cf26 | 2024-02-19 11:08:16 | [diff] [blame] | 10 | namespace plus_addresses::features { |
Jan Keitel | 6ee49f4 | 2024-03-04 10:27:35 | [diff] [blame] | 11 | |
| 12 | namespace { |
| 13 | |
Jan Keitel | 6ee49f4 | 2024-03-04 10:27:35 | [diff] [blame] | 14 | constexpr char kEnterprisePlusAddressOAuthScopeName[] = "oauth-scope"; |
| 15 | constexpr char kEnterprisePlusAddressServerUrlName[] = "server-url"; |
Jan Keitel | 6ee49f4 | 2024-03-04 10:27:35 | [diff] [blame] | 16 | constexpr char kPlusAddressManagementUrlName[] = "manage-url"; |
Timofey Chudakov | 36453fe | 2024-07-02 09:53:13 | [diff] [blame] | 17 | constexpr char kPlusAddressLearnMoreUrlName[] = "learn-more"; |
Jan Keitel | 2ffd4b7 | 2024-10-16 15:05:46 | [diff] [blame] | 18 | constexpr char kPlusAddressRequestTimeoutName[] = "request-timeout"; |
Jan Keitel | 6ee49f4 | 2024-03-04 10:27:35 | [diff] [blame] | 19 | |
| 20 | } // namespace |
| 21 | |
Jan Keitel | fc0e5f2 | 2024-07-25 11:53:37 | [diff] [blame] | 22 | #if BUILDFLAG(IS_ANDROID) |
Timofey Chudakov | 4cb442f | 2024-10-14 14:44:32 | [diff] [blame] | 23 | // When enabled, the user is shown the GMS core plus address management activity |
| 24 | // instead of the web page in a Chrome custom tab. |
| 25 | BASE_FEATURE(kPlusAddressAndroidOpenGmsCoreManagementPage, |
| 26 | "PlusAddressAndroidOpenGmsCoreManagementPage", |
| 27 | base::FEATURE_DISABLED_BY_DEFAULT); |
Jan Keitel | fc0e5f2 | 2024-07-25 11:53:37 | [diff] [blame] | 28 | #endif // BUILDFLAG(IS_ANDROID) |
| 29 | |
Matt Reichhoff | 405469e | 2023-07-28 20:07:30 | [diff] [blame] | 30 | // Controls the enabled/disabled state of the experimental feature. |
Norge Vizcay | 5414f622 | 2024-04-12 12:44:34 | [diff] [blame] | 31 | BASE_FEATURE(kPlusAddressesEnabled, |
Matt Reichhoff | 405469e | 2023-07-28 20:07:30 | [diff] [blame] | 32 | "PlusAddressesEnabled", |
| 33 | base::FEATURE_DISABLED_BY_DEFAULT); |
Matt Reichhoff | 13722ea | 2023-08-14 17:47:45 | [diff] [blame] | 34 | |
Matt Reichhoff | e899e40 | 2023-08-23 13:06:06 | [diff] [blame] | 35 | const base::FeatureParam<std::string> kEnterprisePlusAddressOAuthScope{ |
Norge Vizcay | 5414f622 | 2024-04-12 12:44:34 | [diff] [blame] | 36 | &kPlusAddressesEnabled, kEnterprisePlusAddressOAuthScopeName, ""}; |
Kirubel Aklilu | a7561bfb | 2023-08-24 19:00:21 | [diff] [blame] | 37 | const base::FeatureParam<std::string> kEnterprisePlusAddressServerUrl{ |
Norge Vizcay | 5414f622 | 2024-04-12 12:44:34 | [diff] [blame] | 38 | &kPlusAddressesEnabled, kEnterprisePlusAddressServerUrlName, ""}; |
Matt Reichhoff | 3b45f6d | 2023-09-29 02:56:54 | [diff] [blame] | 39 | const base::FeatureParam<std::string> kPlusAddressManagementUrl{ |
Norge Vizcay | 5414f622 | 2024-04-12 12:44:34 | [diff] [blame] | 40 | &kPlusAddressesEnabled, kPlusAddressManagementUrlName, ""}; |
Timofey Chudakov | 36453fe | 2024-07-02 09:53:13 | [diff] [blame] | 41 | const base::FeatureParam<std::string> kPlusAddressLearnMoreUrl{ |
| 42 | &kPlusAddressesEnabled, kPlusAddressLearnMoreUrlName, ""}; |
Jan Keitel | 2ffd4b7 | 2024-10-16 15:05:46 | [diff] [blame] | 43 | const base::FeatureParam<base::TimeDelta> kPlusAddressRequestTimeout{ |
| 44 | &kPlusAddressesEnabled, kPlusAddressRequestTimeoutName, base::Seconds(5)}; |
Mina Prapakamol | d092fe82 | 2023-12-07 00:07:18 | [diff] [blame] | 45 | |
Norge Vizcay | 57c0ac7 | 2024-04-26 10:45:15 | [diff] [blame] | 46 | // When enabled, plus addresses are supported within the context menu. |
Jan Keitel | 6ee49f4 | 2024-03-04 10:27:35 | [diff] [blame] | 47 | BASE_FEATURE(kPlusAddressFallbackFromContextMenu, |
| 48 | "PlusAddressFallbackFromContextMenu", |
| 49 | base::FEATURE_DISABLED_BY_DEFAULT); |
| 50 | |
Norge Vizcay | 1d4f70b | 2024-09-17 16:37:02 | [diff] [blame] | 51 | // 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. |
| 55 | BASE_FEATURE(kPlusAddressFullFormFill, |
| 56 | "PlusAddressFullFormFill", |
| 57 | base::FEATURE_DISABLED_BY_DEFAULT); |
| 58 | |
Jan Keitel | 2960c63 | 2024-07-31 06:25:19 | [diff] [blame] | 59 | // 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. |
| 64 | BASE_FEATURE(kPlusAddressOfferCreationOnAllNonUsernameFields, |
| 65 | "PlusAddressOfferCreationOnAllNonUsernameFields", |
| 66 | base::FEATURE_ENABLED_BY_DEFAULT); |
| 67 | |
Jan Keitel | a213234 | 2024-10-11 18:22:04 | [diff] [blame] | 68 | // 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. |
| 70 | BASE_FEATURE(kPlusAddressParseExistingProfilesFromCreateResponse, |
| 71 | "PlusAddressParseExistingProfilesFromCreateResponse", |
| 72 | base::FEATURE_ENABLED_BY_DEFAULT); |
| 73 | |
Jan Keitel | b22832b | 2024-08-06 14:36:50 | [diff] [blame] | 74 | // When enabled, plus addresses are preallocated to avoid having to query the |
| 75 | // server for every reserve call. |
| 76 | BASE_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. |
| 82 | extern const base::FeatureParam<int> kPlusAddressPreallocationMinimumSize( |
| 83 | &kPlusAddressPreallocation, |
| 84 | "minimum-size", |
| 85 | 10); |
| 86 | |
Karol Sygiet | fb2fb1d | 2025-01-31 17:31:27 | [diff] [blame] | 87 | // 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. |
| 90 | BASE_FEATURE(kPlusAddressSuggestionsOnUsernameFields, |
| 91 | "PlusAddressSuggestionsOnUsernameFields", |
| 92 | base::FEATURE_DISABLED_BY_DEFAULT); |
| 93 | |
Jan Keitel | 131cf26 | 2024-02-19 11:08:16 | [diff] [blame] | 94 | } // namespace plus_addresses::features |