From f5c6a0136f928804a91d3c57dfcd98e113c29f5f Mon Sep 17 00:00:00 2001 From: cdesouza-chromium Date: Wed, 4 Feb 2026 12:54:52 -0300 Subject: [PATCH] [CodeHealth] Use `base::DictValue`/`base::ListValue` - Part I (#33614) These classes were hoisted and renamed. This has been replaced in Chromium as well. This is a mechanical change for Brave, done with the following script. ``` git grep -lw 'Value::List' | xargs sed -i 's/\bValue::List\b/ListValue/g' git grep -lw 'Value::Dict' | xargs sed -i 's/\bValue::Dict\b/DictValue/g' git cl format ``` Chromium changes: https://chromium.googlesource.com/chromium/src/+/6bc468d481835992696083e99e556516fb7f5f80 ``` commit 6bc468d481835992696083e99e556516fb7f5f80 Author: Avi Drissman Date: Thu Jan 29 22:14:50 2026 -0800 Remove aliases for base::DictValue and base::ListValue This removes a few last stragglers as well. Fixed: 478100525 Cq-Include-Trybots: luci.chromium.try:win-official,mac-official,linux-official,android-official,android-desktop-x64-official Change-Id: If92142b8ab0562a82c609b71c6b2a7665cea6ec6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7513889 Auto-Submit: Avi Drissman Commit-Queue: Daniel Cheng Owners-Override: Daniel Cheng Reviewed-by: Daniel Cheng Cr-Commit-Position: refs/heads/main@{#1577038} ``` Issue: https://github.com/brave/brave-browser/issues/52435 --- base/apple/base_value_bridge+private.h | 8 +++---- base/apple/base_value_bridge.mm | 14 ++++++------ build/ios/mojom/mojom_objc_generator.py | 2 +- chromium_src/base/json/json_reader.cc | 8 +++---- ...i_metadata_component_installer_unittest.cc | 3 +-- .../chrome/browser/importer/importer_list.cc | 2 +- .../profiles/profile_avatar_icon_util.cc | 13 +++++------ .../profiles/profile_avatar_icon_util.h | 7 +++--- .../profile_avatar_icon_util_unittest.cc | 6 ++--- .../password_status_check_service.cc | 2 +- .../password_status_check_service_unittest.cc | 2 +- .../settings/browser_lifetime_handler.cc | 2 +- .../webui/settings/browser_lifetime_handler.h | 2 +- .../webui/settings/search_engines_handler.h | 10 +++++---- .../site_settings_handler_unittest.cc | 4 ++-- .../ui/webui/settings/site_settings_helper.cc | 4 ++-- .../bookmarks/bookmarks_side_panel_ui.cc | 2 +- .../ui/webui/tab_search/tab_search_ui.cc | 2 +- .../browser/search_suggestion_parser.cc | 4 ++-- .../sync/service/sync_internals_util.cc | 4 ++-- .../sync/service/sync_internals_util.h | 2 +- .../components/webui/flags/flags_state.cc | 8 +++---- .../components/webui/flags/flags_state.h | 2 +- .../webui/flags/flags_state_unittest.cc | 4 ++-- .../webui/version/version_handler_helper.cc | 4 ++-- .../web_state_impl_realized_web_state.h | 2 +- .../web_state_impl_realized_web_state.mm | 2 +- chromium_src/ios/web/webui/mojo_facade.mm | 2 +- common/importer/chrome_importer_utils.cc | 22 +++++++++---------- common/importer/chrome_importer_utils.h | 2 +- gin/converter_specializations.cc | 12 +++++----- gin/converter_specializations.h | 8 +++---- .../core/brave_page_graph/blink_converters.h | 6 ++--- .../core/brave_page_graph/blink_probe_types.h | 8 +++---- .../core/brave_page_graph/page_graph.cc | 6 ++--- utility/importer/chrome_importer.cc | 18 +++++++-------- utility/importer/chrome_importer.h | 2 +- 37 files changed, 105 insertions(+), 106 deletions(-) diff --git a/base/apple/base_value_bridge+private.h b/base/apple/base_value_bridge+private.h index d8452ac75d2..b8113ef19a3 100644 --- a/base/apple/base_value_bridge+private.h +++ b/base/apple/base_value_bridge+private.h @@ -28,8 +28,8 @@ NSDictionary* NSDictionaryFromBaseValue( // `base::Value::Type::LIST` base::Value BaseValueFromNSArray(NSArray*); -// Clone the contents of an NSArray into a `base::Value::List` -base::Value::List BaseValueListFromNSArray(NSArray*); +// Clone the contents of an NSArray into a `base::ListValue` +base::ListValue BaseValueListFromNSArray(NSArray*); // Clone the contents of an NSDictionary into a `base::Value` with the type // `base::Value::Type::DICT` @@ -37,8 +37,8 @@ base::Value BaseValueFromNSDictionary( NSDictionary*); NSDictionary* NSDictionaryFromBaseValueDict( - const base::Value::Dict); -base::Value::Dict BaseValueDictFromNSDictionary( + const base::DictValue); +base::DictValue BaseValueDictFromNSDictionary( NSDictionary*); } // namespace brave diff --git a/base/apple/base_value_bridge.mm b/base/apple/base_value_bridge.mm index 553a9e3f655..88512d032ba 100644 --- a/base/apple/base_value_bridge.mm +++ b/base/apple/base_value_bridge.mm @@ -340,15 +340,15 @@ NSDictionary* NSDictionaryFromBaseValue( base::Value BaseValueFromNSArray(NSArray* array) { base::Value value(base::Value::Type::LIST); - base::Value::List& list = *value.GetIfList(); + base::ListValue& list = *value.GetIfList(); for (BaseValueBridge* obj in array) { list.Append(obj.value); } return value; } -base::Value::List BaseValueListFromNSArray(NSArray* array) { - base::Value::List value; +base::ListValue BaseValueListFromNSArray(NSArray* array) { + base::ListValue value; for (BaseValueBridge* obj in array) { value.Append(obj.value); } @@ -358,7 +358,7 @@ base::Value::List BaseValueListFromNSArray(NSArray* array) { base::Value BaseValueFromNSDictionary( NSDictionary* dictionary) { base::Value result(base::Value::Type::DICT); - base::Value::Dict& dict = result.GetDict(); + base::DictValue& dict = result.GetDict(); for (NSString* key in dictionary) { BaseValueBridge* value = dictionary[key]; dict.Set(base::SysNSStringToUTF8(key), value.value); @@ -367,7 +367,7 @@ base::Value BaseValueFromNSDictionary( } NSDictionary* NSDictionaryFromBaseValueDict( - base::Value::Dict value) { + base::DictValue value) { auto result = [[NSMutableDictionary alloc] init]; for (auto kv : value) { result[base::SysUTF8ToNSString(kv.first)] = @@ -376,9 +376,9 @@ NSDictionary* NSDictionaryFromBaseValueDict( return result; } -base::Value::Dict BaseValueDictFromNSDictionary( +base::DictValue BaseValueDictFromNSDictionary( NSDictionary* dictionary) { - base::Value::Dict dict; + base::DictValue dict; for (NSString* key in dictionary) { BaseValueBridge* value = dictionary[key]; dict.Set(base::SysNSStringToUTF8(key), value.value); diff --git a/build/ios/mojom/mojom_objc_generator.py b/build/ios/mojom/mojom_objc_generator.py index fceb2e94ca5..c8c4377c779 100644 --- a/build/ios/mojom/mojom_objc_generator.py +++ b/build/ios/mojom/mojom_objc_generator.py @@ -311,7 +311,7 @@ class BaseDictionaryValueMojoTypemap(MojoTypemap): def ObjCWrappedType(self): return "NSDictionary*" def ExpectedCppType(self): - return "base::Value::Dict" + return "base::DictValue" def DefaultObjCValue(self, default): return "@{}" def ObjCToCpp(self, accessor): diff --git a/chromium_src/base/json/json_reader.cc b/chromium_src/base/json/json_reader.cc index ab65893472c..299e54ae54e 100644 --- a/chromium_src/base/json/json_reader.cc +++ b/chromium_src/base/json/json_reader.cc @@ -16,19 +16,19 @@ namespace serde_json_lenient { // whenever dealing with 64bit integers that cannot be represented in // `base::Value`. -void list_append_i64(base::Value::List& ctx, int64_t val) { +void list_append_i64(base::ListValue& ctx, int64_t val) { NOTIMPLEMENTED(); } -void list_append_u64(base::Value::List& ctx, uint64_t val) { +void list_append_u64(base::ListValue& ctx, uint64_t val) { NOTIMPLEMENTED(); } -void dict_set_i64(base::Value::Dict& ctx, rust::Str key, int64_t val) { +void dict_set_i64(base::DictValue& ctx, rust::Str key, int64_t val) { NOTIMPLEMENTED(); } -void dict_set_u64(base::Value::Dict& ctx, rust::Str key, uint64_t val) { +void dict_set_u64(base::DictValue& ctx, rust::Str key, uint64_t val) { NOTIMPLEMENTED(); } diff --git a/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc b/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc index 65786e468f8..46e7ab04be7 100644 --- a/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc +++ b/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc @@ -14,8 +14,7 @@ TEST_F(PKIMetadataComponentInstallerTest, task_environment_.RunUntilIdle(); WriteKPConfigToFile(); policy_->ComponentReady(base::Version("1.2.3.4"), - component_install_dir_.GetPath(), - base::Value::Dict()); + component_install_dir_.GetPath(), base::DictValue()); task_environment_.RunUntilIdle(); network::NetworkService* network_service = diff --git a/chromium_src/chrome/browser/importer/importer_list.cc b/chromium_src/chrome/browser/importer/importer_list.cc index 7fe4c47f9f0..a4e8f0043f5 100644 --- a/chromium_src/chrome/browser/importer/importer_list.cc +++ b/chromium_src/chrome/browser/importer/importer_list.cc @@ -21,7 +21,7 @@ namespace { void AddChromeToProfiles( std::vector* profiles, - base::Value::List chrome_profiles, + base::ListValue chrome_profiles, const base::FilePath& user_data_folder, const std::string& brand, user_data_importer::ImporterType type) { diff --git a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc index 6552db14475..f74e50d0d8b 100644 --- a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc +++ b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc @@ -215,9 +215,9 @@ gfx::Image GetPlaceholderAvatarIconVisibleAgainstBackground( // GetPlaceholderAvatarIconWithColors function above which is used in this // function. Also, changes the label from "Default Avatar" to our placeholder // avatar name. -base::Value::Dict GetDefaultProfileAvatarIconAndLabel(SkColor fill_color, - SkColor stroke_color, - bool selected) { +base::DictValue GetDefaultProfileAvatarIconAndLabel(SkColor fill_color, + SkColor stroke_color, + bool selected) { gfx::Image icon = profiles::GetPlaceholderAvatarIconWithColors( fill_color, stroke_color, kAvatarIconSize); size_t index = profiles::GetPlaceholderAvatarIndex(); @@ -226,10 +226,9 @@ base::Value::Dict GetDefaultProfileAvatarIconAndLabel(SkColor fill_color, l10n_util::GetStringUTF16(IDS_BRAVE_AVATAR_LABEL_PLACEHOLDER), index, selected, /*is_gaia_avatar=*/false); } -base::Value::Dict GetDefaultProfileAvatarIconAndLabel_Brave( - SkColor fill_color, - SkColor stroke_color, - bool selected) { +base::DictValue GetDefaultProfileAvatarIconAndLabel_Brave(SkColor fill_color, + SkColor stroke_color, + bool selected) { return GetDefaultProfileAvatarIconAndLabel(fill_color, stroke_color, selected); } diff --git a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h index a6e1edd8e35..cdfe202328e 100644 --- a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h +++ b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h @@ -19,10 +19,9 @@ inline constexpr size_t kBraveDefaultAvatarIconsCount = 0; #endif // Provide direct access to custom implementation -base::Value::Dict GetDefaultProfileAvatarIconAndLabel_Brave( - SkColor fill_color, - SkColor stroke_color, - bool selected); +base::DictValue GetDefaultProfileAvatarIconAndLabel_Brave(SkColor fill_color, + SkColor stroke_color, + bool selected); } // namespace profiles #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ diff --git a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc index 26a61dcfb32..ccb97be3b96 100644 --- a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc +++ b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util_unittest.cc @@ -31,7 +31,7 @@ TEST(ProfileUtilTest, KeepChromiumChoice) { TEST(ProfileUtilTest, BraveAvatarIconChoices) { // Test that the avatar icon choices presented to the user are brave's. - base::Value::List avatars = profiles::GetCustomProfileAvatarIconsAndLabels(0); + base::ListValue avatars = profiles::GetCustomProfileAvatarIconsAndLabels(0); const size_t expected_selectable_avatar_count = profiles::kBraveDefaultAvatarIconsCount; @@ -84,9 +84,9 @@ class ProfileAvatarSelectorTest : public testing::Test { TEST_F(ProfileAvatarSelectorTest, ProfileAvatarSelectorPlaceholder) { // Test that the default avatar presented to the user in the profile // customiztion UI is Brave's. - base::Value::List avatars = + base::ListValue avatars = profiles::GetIconsAndLabelsForProfileAvatarSelector(profile()->GetPath()); - const base::Value::Dict* default_avatar = avatars[0].GetIfDict(); + const base::DictValue* default_avatar = avatars[0].GetIfDict(); EXPECT_NE(nullptr, default_avatar); const std::string* label = default_avatar->FindString("label"); diff --git a/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service.cc b/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service.cc index f682ad451c1..8bf6e7eae2d 100644 --- a/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service.cc +++ b/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service.cc @@ -8,7 +8,7 @@ // We hide the password card in brave://settings/safetyCheck, so we don't want // to return recommendations that involve that card #define BRAVE_PASSWORD_STATUS_CHECK_SERVICE_GET_PASSWORD_CARD_DATA \ - base::Value::Dict dict; \ + base::DictValue dict; \ dict.Set(safety_hub::kCardStateKey, \ static_cast(safety_hub::SafetyHubCardState::kSafe)); \ return dict; diff --git a/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service_unittest.cc b/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service_unittest.cc index 881b7735878..5040dd35368 100644 --- a/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service_unittest.cc +++ b/chromium_src/chrome/browser/ui/safety_hub/password_status_check_service_unittest.cc @@ -20,7 +20,7 @@ TEST_P(PasswordStatusCheckServiceParameterizedCardTest, } // The password card data should always be marked safe - base::Value::Dict dict; + base::DictValue dict; dict.Set(safety_hub::kCardStateKey, static_cast(safety_hub::SafetyHubCardState::kSafe)); EXPECT_EQ(dict, service()->GetPasswordCardData(signed_in())); diff --git a/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc b/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc index 9e50e575272..557d36a8967 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc +++ b/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc @@ -19,7 +19,7 @@ namespace settings { BrowserLifetimeHandler::~BrowserLifetimeHandler() {} -void BrowserLifetimeHandler::HandleRelaunch(const base::Value::List& args) { +void BrowserLifetimeHandler::HandleRelaunch(const base::ListValue& args) { #if BUILDFLAG(ENABLE_SPARKLE) if (brave_relaunch_handler::RelaunchOnMac()) { return; diff --git a/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.h b/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.h index 9d37fb210e0..0277fb242fc 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.h +++ b/chromium_src/chrome/browser/ui/webui/settings/browser_lifetime_handler.h @@ -30,7 +30,7 @@ class BrowserLifetimeHandler : public BrowserLifetimeHandler_ChromiumImpl { ~BrowserLifetimeHandler() override; private: - void HandleRelaunch(const base::Value::List& args) override; + void HandleRelaunch(const base::ListValue& args) override; }; } // namespace settings diff --git a/chromium_src/chrome/browser/ui/webui/settings/search_engines_handler.h b/chromium_src/chrome/browser/ui/webui/settings/search_engines_handler.h index afc4c69d7fa..382257297b3 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/search_engines_handler.h +++ b/chromium_src/chrome/browser/ui/webui/settings/search_engines_handler.h @@ -6,10 +6,12 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_SETTINGS_SEARCH_ENGINES_HANDLER_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_SETTINGS_SEARCH_ENGINES_HANDLER_H_ -#define GetSearchEnginesList \ - GetSearchEnginesList_NotUsed() { return {}; } \ - friend class BraveSearchEnginesHandler; \ - virtual base::Value::Dict GetSearchEnginesList +#define GetSearchEnginesList \ + GetSearchEnginesList_NotUsed() { \ + return {}; \ + } \ + friend class BraveSearchEnginesHandler; \ + virtual base::DictValue GetSearchEnginesList #include // IWYU pragma: export diff --git a/chromium_src/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chromium_src/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc index 8190f7f25a5..084eb01a466 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc +++ b/chromium_src/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc @@ -26,7 +26,7 @@ TEST_F(SiteSettingsHandlerTest, ClearBraveShieldMetadata) { HostContentSettingsMap* host_content_settings_map = HostContentSettingsMapFactory::GetForProfile(profile()); - base::Value::Dict shields_metadata; + base::DictValue shields_metadata; shields_metadata.Set("farbling_token", "123"); // Add metadata for the hosts. @@ -44,7 +44,7 @@ TEST_F(SiteSettingsHandlerTest, ClearBraveShieldMetadata) { .size()); // Clear at the eTLD+1 level and ensure affected origins are cleared. - base::Value::List args; + base::ListValue args; args.Append(GroupingKey::CreateFromEtldPlus1("example.com").Serialize()); handler()->HandleClearSiteGroupDataAndCookies(args); ContentSettingsForOneType shields_metadata_settings = diff --git a/chromium_src/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chromium_src/chrome/browser/ui/webui/settings/site_settings_helper.cc index 0ab0a25c540..7f12e273c34 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/site_settings_helper.cc +++ b/chromium_src/chrome/browser/ui/webui/settings/site_settings_helper.cc @@ -108,7 +108,7 @@ void BraveGetExceptionForPage(ContentSettingsType type, const ContentSettingsPattern& pattern, const ContentSettingsPattern& secondary_pattern, const ContentSetting& setting, - base::Value::Dict& exception); + base::DictValue& exception); } // namespace #include @@ -180,7 +180,7 @@ void BraveGetExceptionForPage(ContentSettingsType type, const ContentSettingsPattern& pattern, const ContentSettingsPattern& secondary_pattern, const ContentSetting& setting, - base::Value::Dict& exception) { + base::DictValue& exception) { constexpr char kBraveCookieType[] = "braveCookieType"; // Update the RawSiteException.braveCookieType declaration in diff --git a/chromium_src/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.cc b/chromium_src/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.cc index 0f4d11c396c..c13177ff8ac 100644 --- a/chromium_src/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.cc +++ b/chromium_src/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.cc @@ -31,7 +31,7 @@ std::optional BookmarksSidePanelUIConfig::GetCommandIdForTesting() { BookmarksSidePanelUI::BookmarksSidePanelUI(content::WebUI* web_ui) : BookmarksSidePanelUI_ChromiumImpl(web_ui) { - base::Value::Dict update_data; + base::DictValue update_data; update_data.Set("sortCustom", l10n_util::GetStringUTF16(IDS_BOOKMARKS_SORT_CUSTOM)); update_data.Set("sortCustomLower", diff --git a/chromium_src/chrome/browser/ui/webui/tab_search/tab_search_ui.cc b/chromium_src/chrome/browser/ui/webui/tab_search/tab_search_ui.cc index 04c5659c832..26087b820ad 100644 --- a/chromium_src/chrome/browser/ui/webui/tab_search/tab_search_ui.cc +++ b/chromium_src/chrome/browser/ui/webui/tab_search/tab_search_ui.cc @@ -21,7 +21,7 @@ TabSearchUI::TabSearchUI(content::WebUI* web_ui) : TabSearchUI_ChromiumImpl(web_ui) { Profile* profile = Profile::FromWebUI(web_ui); - base::Value::Dict update_data; + base::DictValue update_data; #if BUILDFLAG(ENABLE_AI_CHAT) update_data.Set( diff --git a/chromium_src/components/omnibox/browser/search_suggestion_parser.cc b/chromium_src/components/omnibox/browser/search_suggestion_parser.cc index 537a4e41666..9f644c3caec 100644 --- a/chromium_src/components/omnibox/browser/search_suggestion_parser.cc +++ b/chromium_src/components/omnibox/browser/search_suggestion_parser.cc @@ -19,7 +19,7 @@ // static bool SearchSuggestionParser::ParseSuggestResults( - const base::Value::List& root_list, + const base::ListValue& root_list, const AutocompleteInput& input, const AutocompleteSchemeClassifier& scheme_classifier, int default_result_relevance, @@ -38,7 +38,7 @@ bool SearchSuggestionParser::ParseSuggestResults( // static bool SearchSuggestionParser::ParseSuggestResults( - const base::Value::List& root_list, + const base::ListValue& root_list, const AutocompleteInput& input, const AutocompleteSchemeClassifier& scheme_classifier, int default_result_relevance, diff --git a/chromium_src/components/sync/service/sync_internals_util.cc b/chromium_src/components/sync/service/sync_internals_util.cc index c9965bd1737..d1d470244f8 100644 --- a/chromium_src/components/sync/service/sync_internals_util.cc +++ b/chromium_src/components/sync/service/sync_internals_util.cc @@ -15,7 +15,7 @@ namespace syncer::sync_ui_util { -base::Value::Dict ConstructAboutInformation( +base::DictValue ConstructAboutInformation( IncludeSensitiveData include_sensitive_data, SyncService* service, const std::string& channel) { @@ -52,7 +52,7 @@ base::Value::Dict ConstructAboutInformation( section_brave_sync.AddStringStat("Leave chain details"); leave_chain_details->Set(brave_sync_service->prefs().GetLeaveChainDetails()); - base::Value::List* details = about_info.FindList(kDetailsKey); + base::ListValue* details = about_info.FindList(kDetailsKey); DCHECK_NE(details, nullptr); details->Append(section_brave_sync.ToValue()); diff --git a/chromium_src/components/sync/service/sync_internals_util.h b/chromium_src/components/sync/service/sync_internals_util.h index 95285367b73..e65c58d3027 100644 --- a/chromium_src/components/sync/service/sync_internals_util.h +++ b/chromium_src/components/sync/service/sync_internals_util.h @@ -16,7 +16,7 @@ namespace syncer { namespace sync_ui_util { -base::Value::Dict ConstructAboutInformation( +base::DictValue ConstructAboutInformation( IncludeSensitiveData include_sensitive_data, SyncService* service, const std::string& channel); diff --git a/chromium_src/components/webui/flags/flags_state.cc b/chromium_src/components/webui/flags/flags_state.cc index 3aad25bb7a2..44f7f083700 100644 --- a/chromium_src/components/webui/flags/flags_state.cc +++ b/chromium_src/components/webui/flags/flags_state.cc @@ -20,7 +20,7 @@ namespace { void AppendCurrentFeatureStateIfDefault( const FeatureEntry& entry, const std::set& enabled_entries, - base::Value::List& result) { + base::ListValue& result) { if (std::ranges::any_of(result, [](const base::Value& v) { return *v.GetDict().FindBool("selected"); })) { @@ -58,11 +58,11 @@ void AppendCurrentFeatureStateIfDefault( } // namespace -// Returns the Value::List representing the choice data in the specified entry. -base::Value::List FlagsState::CreateOptionsData( +// Returns the ListValue representing the choice data in the specified entry. +base::ListValue FlagsState::CreateOptionsData( const FeatureEntry& entry, const std::set& enabled_entries) const { - base::Value::List result = + base::ListValue result = ::flags_ui::CreateOptionsData(entry, enabled_entries); if (entry.type == FeatureEntry::FEATURE_VALUE || diff --git a/chromium_src/components/webui/flags/flags_state.h b/chromium_src/components/webui/flags/flags_state.h index bab537e7ec3..a97be412fed 100644 --- a/chromium_src/components/webui/flags/flags_state.h +++ b/chromium_src/components/webui/flags/flags_state.h @@ -8,7 +8,7 @@ #define GetFlagFeatureEntries(...) \ GetFlagFeatureEntries(__VA_ARGS__); \ - base::Value::List CreateOptionsData( \ + base::ListValue CreateOptionsData( \ const FeatureEntry& entry, const std::set& enabled_entries) \ const diff --git a/chromium_src/components/webui/flags/flags_state_unittest.cc b/chromium_src/components/webui/flags/flags_state_unittest.cc index dcff478c864..aa553507304 100644 --- a/chromium_src/components/webui/flags/flags_state_unittest.cc +++ b/chromium_src/components/webui/flags/flags_state_unittest.cc @@ -21,8 +21,8 @@ TEST_F(FlagsStateTest, ShowDefaultState) { scoped_feature_list.InitAndDisableFeature(kTestFeature2); // Get flag feature entries. - base::Value::List supported_entries; - base::Value::List unsupported_entries; + base::ListValue supported_entries; + base::ListValue unsupported_entries; flags_state_->GetFlagFeatureEntries(&flags_storage_, kGeneralAccessFlagsOnly, supported_entries, unsupported_entries, base::BindRepeating(&SkipFeatureEntry)); diff --git a/chromium_src/components/webui/version/version_handler_helper.cc b/chromium_src/components/webui/version/version_handler_helper.cc index d263438cede..9ab5d5535bb 100644 --- a/chromium_src/components/webui/version/version_handler_helper.cc +++ b/chromium_src/components/webui/version/version_handler_helper.cc @@ -12,7 +12,7 @@ namespace version_ui { // Brave always shows full variations names instead of hashes. -base::Value::List GetVariationsList() { +base::ListValue GetVariationsList() { std::vector variations; base::FieldTrial::ActiveGroups active_groups; base::FieldTrialList::GetActiveFieldTrialGroups(&active_groups); @@ -26,7 +26,7 @@ base::Value::List GetVariationsList() { variations.push_back(line); } - base::Value::List variations_list; + base::ListValue variations_list; const std::string& seed_version = variations::GetSeedVersion(); if (!seed_version.empty() && seed_version != "1") { variations_list.Append(seed_version); diff --git a/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.h b/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.h index b0bd6d45194..9f550006d34 100644 --- a/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.h +++ b/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.h @@ -25,7 +25,7 @@ void ClearWebUI_ChromiumImpl(); \ bool HasWebUI_ChromiumImpl() const; \ void HandleWebUIMessage_ChromiumImpl(const GURL&, std::string_view, \ - const base::Value::List&) + const base::ListValue&) // Exposes an API to obtain the main frame WebUI which is required for some // Brave WebUI implementations #define ClearWebUI \ diff --git a/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.mm b/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.mm index 325d2197217..8e1bfce4dd9 100644 --- a/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.mm +++ b/chromium_src/ios/web/web_state/web_state_impl_realized_web_state.mm @@ -57,7 +57,7 @@ void WebStateImpl::RealizedWebState::ClearWebUI() { void WebStateImpl::RealizedWebState::HandleWebUIMessage( const GURL& source_url, std::string_view message, - const base::Value::List& args) { + const base::ListValue& args) { const std::string_view host = source_url.host(); auto web_ui = web_uis_.find(host); if (web_ui != web_uis_.end() && web_ui->second) { diff --git a/chromium_src/ios/web/webui/mojo_facade.mm b/chromium_src/ios/web/webui/mojo_facade.mm index 56a3e3e9e37..bb7b72c0b76 100644 --- a/chromium_src/ios/web/webui/mojo_facade.mm +++ b/chromium_src/ios/web/webui/mojo_facade.mm @@ -56,7 +56,7 @@ bool MojoFacade::IsWebUIMessageAllowedForFrame(const GURL& origin, // If the scheme is untrusted if (name_and_args.name == "Mojo.bindInterface" && origin.scheme() == "chrome-untrusted") { - const base::Value::Dict& args = name_and_args.args; + const base::DictValue& args = name_and_args.args; const std::string* interface_name = args.FindString("interfaceName"); CHECK(interface_name); diff --git a/common/importer/chrome_importer_utils.cc b/common/importer/chrome_importer_utils.cc index a48f7ce48e2..a4ee644317e 100644 --- a/common/importer/chrome_importer_utils.cc +++ b/common/importer/chrome_importer_utils.cc @@ -34,7 +34,7 @@ using extensions::Manifest; namespace { #if BUILDFLAG(ENABLE_EXTENSIONS) -std::optional GetChromeExtensionsListFromFile( +std::optional GetChromeExtensionsListFromFile( const base::FilePath& preference_path) { if (!base::PathExists(preference_path)) return std::nullopt; @@ -42,7 +42,7 @@ std::optional GetChromeExtensionsListFromFile( std::string preference_content; base::ReadFileToString(preference_path, &preference_content); - std::optional preference = base::JSONReader::ReadDict( + std::optional preference = base::JSONReader::ReadDict( preference_content, base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (!preference) { return std::nullopt; @@ -59,13 +59,13 @@ bool HasImportableExtensions(const base::FilePath& profile_path) { } std::vector GetImportableListFromChromeExtensionsList( - const base::Value::Dict& extensions_list) { + const base::DictValue& extensions_list) { std::vector extensions; for (const auto [key, value] : extensions_list) { if (!value.is_dict()) { continue; } - const base::Value::Dict& dict = value.GetDict(); + const base::DictValue& dict = value.GetDict(); // Only import if type is extension, it's came from webstore and it's not // installed by default. if (dict.FindBool("was_installed_by_default").value_or(true)) @@ -99,7 +99,7 @@ std::vector GetImportableListFromChromeExtensionsList( return extensions; } -std::optional GetChromeExtensionsList( +std::optional GetChromeExtensionsList( const base::FilePath& profile_path) { auto list_from_secure_preference = GetChromeExtensionsListFromFile( profile_path.AppendASCII(kChromeSecurePreferencesFile)); @@ -140,7 +140,7 @@ bool HasPaymentMethods(const base::FilePath& payments_path) { } bool IsLastActiveProfile(const std::string& profile, - const base::Value::List& last_active_profiles) { + const base::ListValue& last_active_profiles) { for (const auto& it : last_active_profiles) { if (it.GetString() == profile) { return true; @@ -170,13 +170,13 @@ bool CanImportPasswordsForType(user_data_importer::ImporterType type) { } // namespace -base::Value::List GetChromeSourceProfiles( +base::ListValue GetChromeSourceProfiles( const base::FilePath& local_state_path) { - base::Value::List profiles; + base::ListValue profiles; if (base::PathExists(local_state_path)) { std::string local_state_content; base::ReadFileToString(local_state_path, &local_state_content); - std::optional local_state_dict = + std::optional local_state_dict = base::JSONReader::ReadDict(local_state_content, base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (!local_state_dict) @@ -198,7 +198,7 @@ base::Value::List GetChromeSourceProfiles( if (!name) { continue; } - base::Value::Dict entry; + base::DictValue entry; entry.Set("id", value.first); entry.Set("name", *name); if (last_active_profiles) @@ -219,7 +219,7 @@ base::Value::List GetChromeSourceProfiles( } } if (profiles.empty()) { - base::Value::Dict entry; + base::DictValue entry; entry.Set("id", ""); entry.Set("name", "Default"); profiles.Append(std::move(entry)); diff --git a/common/importer/chrome_importer_utils.h b/common/importer/chrome_importer_utils.h index 2a227471650..b4d5d4cf49a 100644 --- a/common/importer/chrome_importer_utils.h +++ b/common/importer/chrome_importer_utils.h @@ -37,7 +37,7 @@ base::FilePath GetWhaleUserDataFolder(); #if BUILDFLAG(IS_LINUX) base::FilePath GetOperaSnapUserDataFolder(); #endif -base::Value::List GetChromeSourceProfiles(const base::FilePath& local_state); +base::ListValue GetChromeSourceProfiles(const base::FilePath& local_state); bool ChromeImporterCanImport(const base::FilePath& profile, user_data_importer::ImporterType type, uint16_t* services_supported); diff --git a/gin/converter_specializations.cc b/gin/converter_specializations.cc index b6d28458de2..a98e5598c53 100644 --- a/gin/converter_specializations.cc +++ b/gin/converter_specializations.cc @@ -11,9 +11,9 @@ #include "content/public/renderer/v8_value_converter.h" namespace gin { -bool Converter::FromV8(v8::Isolate* isolate, - v8::Local v8_value, - base::Value::List* out) { +bool Converter::FromV8(v8::Isolate* isolate, + v8::Local v8_value, + base::ListValue* out) { std::unique_ptr base_value = content::V8ValueConverter::Create()->FromV8Value( v8_value, isolate->GetCurrentContext()); @@ -25,9 +25,9 @@ bool Converter::FromV8(v8::Isolate* isolate, return true; } -bool Converter::FromV8(v8::Isolate* isolate, - v8::Local v8_value, - base::Value::Dict* out) { +bool Converter::FromV8(v8::Isolate* isolate, + v8::Local v8_value, + base::DictValue* out) { std::unique_ptr base_value = content::V8ValueConverter::Create()->FromV8Value( v8_value, isolate->GetCurrentContext()); diff --git a/gin/converter_specializations.h b/gin/converter_specializations.h index c98289d17bb..d76a6037b28 100644 --- a/gin/converter_specializations.h +++ b/gin/converter_specializations.h @@ -13,17 +13,17 @@ namespace gin { template <> -struct Converter { +struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Local v8_value, - base::Value::List* out); + base::ListValue* out); }; template <> -struct Converter { +struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Local v8_value, - base::Value::Dict* out); + base::DictValue* out); }; } // namespace gin diff --git a/third_party/blink/renderer/core/brave_page_graph/blink_converters.h b/third_party/blink/renderer/core/brave_page_graph/blink_converters.h index 90e8b22717c..d7c98829123 100644 --- a/third_party/blink/renderer/core/brave_page_graph/blink_converters.h +++ b/third_party/blink/renderer/core/brave_page_graph/blink_converters.h @@ -141,7 +141,7 @@ base::Value ToPageGraphValue(ScriptState* script_state, T& value) { template requires(pg_internal::convert_as_iterable) base::Value ToPageGraphValue(ScriptState* script_state, const T& values) { - base::Value::List list_values; + base::ListValue list_values; for (const auto& value : values) { list_values.Append(ToPageGraphValue(script_state, value)); } @@ -151,7 +151,7 @@ base::Value ToPageGraphValue(ScriptState* script_state, const T& values) { // Helper for tuple types converter. template void ToPageGraphValueImpl(ScriptState* script_state, - base::Value::List& list_values, + base::ListValue& list_values, const std::tuple& values, std::index_sequence) { (list_values.Append(ToPageGraphValue(script_state, std::get(values))), @@ -162,7 +162,7 @@ void ToPageGraphValueImpl(ScriptState* script_state, template base::Value ToPageGraphValue(ScriptState* script_state, const std::tuple& values) { - base::Value::List list_values; + base::ListValue list_values; ToPageGraphValueImpl(script_state, list_values, values, std::index_sequence_for{}); return base::Value(std::move(list_values)); diff --git a/third_party/blink/renderer/core/brave_page_graph/blink_probe_types.h b/third_party/blink/renderer/core/brave_page_graph/blink_probe_types.h index 53a4ff4d13d..cadc9f1fe0f 100644 --- a/third_party/blink/renderer/core/brave_page_graph/blink_probe_types.h +++ b/third_party/blink/renderer/core/brave_page_graph/blink_probe_types.h @@ -15,8 +15,8 @@ namespace blink { using PageGraphValue = base::Value; -using PageGraphValues = base::Value::List; -using PageGraphObject = base::Value::Dict; +using PageGraphValues = base::ListValue; +using PageGraphObject = base::DictValue; enum class PageGraphBindingType { kAttribute, @@ -34,8 +34,8 @@ enum class PageGraphBindingEvent { }; template -base::Value::List CreatePageGraphValues(Args&&... args) { - base::Value::List list; +base::ListValue CreatePageGraphValues(Args&&... args) { + base::ListValue list; list.reserve(sizeof...(Args)); (list.Append(std::forward(args)), ...); return list; diff --git a/third_party/blink/renderer/core/brave_page_graph/page_graph.cc b/third_party/blink/renderer/core/brave_page_graph/page_graph.cc index f09f2a731fd..6df18449728 100644 --- a/third_party/blink/renderer/core/brave_page_graph/page_graph.cc +++ b/third_party/blink/renderer/core/brave_page_graph/page_graph.cc @@ -961,7 +961,7 @@ void PageGraph::ConsoleMessageAdded(blink::ConsoleMessage* console_message) { } std::ostringstream str; - base::Value::Dict dict; + base::DictValue dict; str << console_message->GetSource(); dict.Set("source", str.str()); str.str(""); @@ -969,7 +969,7 @@ void PageGraph::ConsoleMessageAdded(blink::ConsoleMessage* console_message) { dict.Set("level", str.str()); dict.Set("message", console_message->Message().Utf8()); - base::Value::Dict loc; + base::DictValue loc; loc.Set("url", console_message->Location()->Url().Utf8()); loc.Set("line", static_cast(console_message->Location()->LineNumber())); loc.Set("column", @@ -977,7 +977,7 @@ void PageGraph::ConsoleMessageAdded(blink::ConsoleMessage* console_message) { loc.Set("script_id", console_message->Location()->ScriptId()); dict.Set("location", std::move(loc)); - base::Value::List args; + base::ListValue args; args.Append(std::move(dict)); RegisterWebAPICall(execution_context, "ConsoleMessageAdded", std::move(args)); } diff --git a/utility/importer/chrome_importer.cc b/utility/importer/chrome_importer.cc index e3bbf27abd6..4da3de6c7f3 100644 --- a/utility/importer/chrome_importer.cc +++ b/utility/importer/chrome_importer.cc @@ -81,7 +81,7 @@ bool SetEncryptionKeyForPasswordImporting( const base::FilePath& local_state_path) { std::string local_state_content; base::ReadFileToString(local_state_path, &local_state_content); - std::optional local_state = base::JSONReader::ReadDict( + std::optional local_state = base::JSONReader::ReadDict( local_state_content, base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (!local_state) { return false; @@ -248,16 +248,16 @@ void ChromeImporter::ImportBookmarks() { base::ReadFileToString(copy_bookmark_file.copied_file_path(), &bookmarks_content); - std::optional bookmark_dict = base::JSONReader::ReadDict( + std::optional bookmark_dict = base::JSONReader::ReadDict( bookmarks_content, base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (!bookmark_dict) return; std::vector bookmarks; - const base::Value::Dict* roots = bookmark_dict->FindDict("roots"); + const base::DictValue* roots = bookmark_dict->FindDict("roots"); if (roots) { // Importing bookmark bar items - const base::Value::Dict* bookmark_bar = roots->FindDict("bookmark_bar"); + const base::DictValue* bookmark_bar = roots->FindDict("bookmark_bar"); if (bookmark_bar) { std::vector path; const auto* name = bookmark_bar->FindString("name"); @@ -266,7 +266,7 @@ void ChromeImporter::ImportBookmarks() { RecursiveReadBookmarksFolder(bookmark_bar, path, true, &bookmarks); } // Importing other items - const base::Value::Dict* other = roots->FindDict("other"); + const base::DictValue* other = roots->FindDict("other"); if (other) { std::vector path; const auto* name = other->FindString("name"); @@ -360,14 +360,14 @@ void ChromeImporter::LoadFaviconData( } void ChromeImporter::RecursiveReadBookmarksFolder( - const base::Value::Dict* folder, + const base::DictValue* folder, const std::vector& parent_path, bool is_in_toolbar, std::vector* bookmarks) { - const base::Value::List* children = folder->FindList("children"); + const base::ListValue* children = folder->FindList("children"); if (children) { for (const auto& value : *children) { - const base::Value::Dict* dict = value.GetIfDict(); + const base::DictValue* dict = value.GetIfDict(); if (!dict) continue; const auto* date_added = dict->FindString("date_added"); @@ -379,7 +379,7 @@ void ChromeImporter::RecursiveReadBookmarksFolder( if (type && *type == "folder") { // Folders are added implicitly on adding children, so we only // explicitly add empty folders. - const base::Value::List* inner_children = dict->FindList("children"); + const base::ListValue* inner_children = dict->FindList("children"); if (inner_children && inner_children->empty()) { entry.in_toolbar = is_in_toolbar; entry.is_folder = true; diff --git a/utility/importer/chrome_importer.h b/utility/importer/chrome_importer.h index 59093edba2f..e8eb1deb3b7 100644 --- a/utility/importer/chrome_importer.h +++ b/utility/importer/chrome_importer.h @@ -66,7 +66,7 @@ class ChromeImporter : public Importer { favicon_base::FaviconUsageDataList* favicons); void RecursiveReadBookmarksFolder( - const base::Value::Dict* folder, + const base::DictValue* folder, const std::vector& parent_path, bool is_in_toolbar, std::vector* bookmarks);