diff --git a/browser/about_flags.cc b/browser/about_flags.cc index 63f323293a98..96a96daad11e 100644 --- a/browser/about_flags.cc +++ b/browser/about_flags.cc @@ -854,15 +854,6 @@ kOsDesktop | kOsAndroid, \ FEATURE_VALUE_TYPE(translate::kTranslate), \ }, \ - { \ - "brave-sync-history-diagnostics", \ - "Enable Brave Sync History Diagnostics", \ - "Brave Sync History Diagnostics flag displays additional sync " \ - "related information on History page", \ - kOsAll, \ - FEATURE_VALUE_TYPE( \ - brave_sync::features::kBraveSyncHistoryDiagnostics), \ - }, \ { \ "restrict-event-source-pool", \ "Restrict Event Source Pool", \ @@ -870,14 +861,6 @@ kOsAll, \ FEATURE_VALUE_TYPE(blink::features::kRestrictEventSourcePool), \ }, \ - { \ - "brave-sync-send-all-history", \ - "Send All History to Brave Sync", \ - "With Send All History flag all sync entries are sent to Sync " \ - "server including transitions of link, bookmark, reload, etc", \ - kOsAll, \ - FEATURE_VALUE_TYPE(brave_sync::features::kBraveSyncSendAllHistory), \ - }, \ { \ "brave-copy-clean-link-by-default", \ "Override default copy hotkey with copy clean link", \ diff --git a/build/config/brave_build.gni b/build/config/brave_build.gni index b6809a89fc69..0d2e07fd90eb 100644 --- a/build/config/brave_build.gni +++ b/build/config/brave_build.gni @@ -20,7 +20,6 @@ import("//brave/components/content_settings/core/browser/sources.gni") import("//brave/components/omnibox/browser/sources.gni") import("//brave/components/search_engines/sources.gni") import("//brave/components/sync/service/sources.gni") -import("//brave/components/sync/sources.gni") import("//brave/components/sync_device_info/sources.gni") import("//brave/components/update_client/sources.gni") import("//brave/installer/linux/sources.gni") diff --git a/chromium_src/check_chromium_src_config.json5 b/chromium_src/check_chromium_src_config.json5 index d67dd09f6941..98a58f5c27c4 100644 --- a/chromium_src/check_chromium_src_config.json5 +++ b/chromium_src/check_chromium_src_config.json5 @@ -39,8 +39,6 @@ "chrome/install_static/brave_restore_google_update_integration.h", "chrome/install_static/brave_stash_google_update_integration.h", "chrome/install_static/brave_user_data_dir_win_unittest.cc", - "components/history/core/browser/sync/brave_typed_url_sync_bridge_unittest.cc", - "components/history/core/browser/sync/chromium_typed_url_sync_bridge_unittest.cc", "components/privacy_sandbox/privacy_sandbox_settings_unittest.cc", "components/search_engines/brave_template_url_prepopulate_data_unittest.cc", "components/search_engines/brave_template_url_service_util_unittest.cc", diff --git a/chromium_src/components/browser_sync/DEPS b/chromium_src/components/browser_sync/DEPS new file mode 100644 index 000000000000..425a4aee5661 --- /dev/null +++ b/chromium_src/components/browser_sync/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h", + "+brave/components/history/core/browser/sync/brave_history_model_type_controller.h", +] diff --git a/chromium_src/components/browser_sync/sync_api_component_factory_impl.cc b/chromium_src/components/browser_sync/sync_api_component_factory_impl.cc new file mode 100644 index 000000000000..9816d86c7c9a --- /dev/null +++ b/chromium_src/components/browser_sync/sync_api_component_factory_impl.cc @@ -0,0 +1,17 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h" +#include "brave/components/history/core/browser/sync/brave_history_model_type_controller.h" + +#define HistoryDeleteDirectivesModelTypeController \ + BraveHistoryDeleteDirectivesModelTypeController + +#define HistoryModelTypeController BraveHistoryModelTypeController + +#include "src/components/browser_sync/sync_api_component_factory_impl.cc" + +#undef HistoryModelTypeController +#undef HistoryDeleteDirectivesModelTypeController diff --git a/chromium_src/components/history/core/browser/history_backend.cc b/chromium_src/components/history/core/browser/history_backend.cc deleted file mode 100644 index 93beb77ef4ef..000000000000 --- a/chromium_src/components/history/core/browser/history_backend.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include - -#include "base/check.h" -#include "base/feature_list.h" -#include "base/strings/strcat.h" -#include "brave/components/brave_sync/features.h" -#include "brave/components/history/core/browser/sync/brave_typed_url_sync_bridge.h" -// Forward include to avoid re-define of URLResult::set_blocked_visit -#include "components/history/core/browser/history_types.h" -#include "components/history/core/browser/url_row.h" -#include "ui/base/page_transition_types.h" - -namespace { - -std::u16string GetTransitionString(ui::PageTransition transition_flags) { - std::u16string transition; - switch (transition_flags & ui::PAGE_TRANSITION_CORE_MASK) { -#define TRANSITION_CASE(FLAG) \ - case ui::FLAG: \ - transition = u## #FLAG; \ - break; - - TRANSITION_CASE(PAGE_TRANSITION_LINK) - TRANSITION_CASE(PAGE_TRANSITION_TYPED) - TRANSITION_CASE(PAGE_TRANSITION_AUTO_BOOKMARK) - TRANSITION_CASE(PAGE_TRANSITION_AUTO_SUBFRAME) - TRANSITION_CASE(PAGE_TRANSITION_MANUAL_SUBFRAME) - TRANSITION_CASE(PAGE_TRANSITION_GENERATED) - TRANSITION_CASE(PAGE_TRANSITION_AUTO_TOPLEVEL) - TRANSITION_CASE(PAGE_TRANSITION_FORM_SUBMIT) - TRANSITION_CASE(PAGE_TRANSITION_RELOAD) - TRANSITION_CASE(PAGE_TRANSITION_KEYWORD) - TRANSITION_CASE(PAGE_TRANSITION_KEYWORD_GENERATED) - -#undef TRANSITION_CASE - - default: - DCHECK(false); - } - - return transition; -} - -// Taken from TypedURLSyncBridge::ShouldSyncVisit, it's not static, so can't be -// used directly -bool ShouldSyncVisit(int typed_count, ui::PageTransition transition) { - static const int kTypedUrlVisitThrottleThreshold = 10; - static const int kTypedUrlVisitThrottleMultiple = 10; - - return (ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED) && - (typed_count < kTypedUrlVisitThrottleThreshold || - (typed_count % kTypedUrlVisitThrottleMultiple) == 0)); -} - -std::u16string GetDiagnosticTitle(const history::URLResult& url_result, - const history::VisitRow& visit) { - if (base::FeatureList::IsEnabled( - brave_sync::features::kBraveSyncHistoryDiagnostics)) { - return base::StrCat( - {u"ShouldSync:", - ShouldSyncVisit(url_result.typed_count(), visit.transition) ? u"1" - : u"0", - u" ", std::u16string(u"TypedCount:"), - base::NumberToString16(url_result.typed_count()), u" ", - GetTransitionString(visit.transition), u" ", url_result.title()}); - } else { - return url_result.title(); - } -} - -} // namespace - -// It's possible to redefine set_blocked_visit because it appears only once at -// history_backend.cc -#define set_blocked_visit \ - set_title(GetDiagnosticTitle(url_result, visit)); \ - url_result.set_blocked_visit - -#define TypedURLSyncBridge BraveTypedURLSyncBridge - -#include "src/components/history/core/browser/history_backend.cc" - -#undef TypedURLSyncBridge -#undef set_blocked_visit diff --git a/chromium_src/components/history/core/browser/history_backend.h b/chromium_src/components/history/core/browser/history_backend.h deleted file mode 100644 index 7daa9c1f93ff..000000000000 --- a/chromium_src/components/history/core/browser/history_backend.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ -#define BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ - -#define TypedURLSyncBridge BraveTypedURLSyncBridge -#include "src/components/history/core/browser/history_backend.h" // IWYU pragma: export -#undef TypedURLSyncBridge - -#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ diff --git a/chromium_src/components/history/core/browser/sync/DEPS b/chromium_src/components/history/core/browser/sync/DEPS new file mode 100644 index 000000000000..f7b30ce80708 --- /dev/null +++ b/chromium_src/components/history/core/browser/sync/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+src/components/history/core/browser/sync/delete_directive_handler_unittest.cc", +] diff --git a/chromium_src/components/history/core/browser/sync/brave_typed_url_sync_bridge_unittest.cc b/chromium_src/components/history/core/browser/sync/brave_typed_url_sync_bridge_unittest.cc deleted file mode 100644 index 86f295ffd1ad..000000000000 --- a/chromium_src/components/history/core/browser/sync/brave_typed_url_sync_bridge_unittest.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// Run all TypedURLSyncBridgeTest again but with kBraveSyncSendAllHistory -// feature enabled - -#include "brave/components/history/core/browser/sync/brave_typed_url_sync_bridge.h" -#include "base/test/scoped_feature_list.h" -#include "brave/components/brave_sync/features.h" - -#define BRAVE_TEST_MEMBERS_DECLARE \ - base::test::ScopedFeatureList scoped_feature_list_; \ - int kVisitThrottleThreshold; \ - int kVisitThrottleMultiple; - -#define BRAVE_TEST_MEMBERS_INIT \ - scoped_feature_list_.InitWithFeatures( \ - {brave_sync::features::kBraveSyncSendAllHistory}, {}); \ - /* Need these overrides only for */ \ - /* BraveTypedURLSyncBridgeTest.ThrottleVisitLocalTypedUrl only */ \ - kVisitThrottleThreshold = \ - typed_url_sync_bridge_->GetSendAllFlagVisitThrottleThreshold(); \ - kVisitThrottleMultiple = \ - typed_url_sync_bridge_->GetSendAllFlagVisitThrottleMultiple(); - -#define TypedURLSyncBridge BraveTypedURLSyncBridge -#define TypedURLSyncBridgeTest BraveTypedURLSyncBridgeTest -#include "src/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc" -#undef TypedURLSyncBridgeTest -#undef TypedURLSyncBridge -#undef BRAVE_TEST_MEMBERS_INIT -#undef BRAVE_TEST_MEMBERS_DECLARE - -namespace { - -bool IsSendAllHistoryEnabled() { - return base::FeatureList::IsEnabled( - brave_sync::features::kBraveSyncSendAllHistory); -} - -} // namespace - -namespace history { - -URLRow MakeUrlRow(int visit_count, int typed_count) { - URLRow urlRow; - urlRow.set_visit_count(visit_count); - urlRow.set_typed_count(typed_count); - return urlRow; -} - -TEST_F(BraveTypedURLSyncBridgeTest, BraveShouldSyncVisit) { - ASSERT_TRUE(IsSendAllHistoryEnabled()); - - EXPECT_TRUE( - bridge()->ShouldSyncVisit(MakeUrlRow(1, 0), ui::PAGE_TRANSITION_LINK)); - EXPECT_TRUE( - bridge()->ShouldSyncVisit(MakeUrlRow(1, 0), ui::PAGE_TRANSITION_TYPED)); - EXPECT_TRUE( - bridge()->ShouldSyncVisit(MakeUrlRow(20, 0), ui::PAGE_TRANSITION_LINK)); - EXPECT_FALSE( - bridge()->ShouldSyncVisit(MakeUrlRow(21, 0), ui::PAGE_TRANSITION_LINK)); - EXPECT_TRUE( - bridge()->ShouldSyncVisit(MakeUrlRow(30, 0), ui::PAGE_TRANSITION_LINK)); - - { - base::test::ScopedFeatureList scoped_feature_list2; - scoped_feature_list2.InitWithFeatures( - {}, {brave_sync::features::kBraveSyncSendAllHistory}); - EXPECT_FALSE( - bridge()->ShouldSyncVisit(MakeUrlRow(1, 0), ui::PAGE_TRANSITION_LINK)); - EXPECT_TRUE( - bridge()->ShouldSyncVisit(MakeUrlRow(1, 1), ui::PAGE_TRANSITION_TYPED)); - EXPECT_FALSE(bridge()->ShouldSyncVisit(MakeUrlRow(20, 20), - ui::PAGE_TRANSITION_LINK)); - EXPECT_TRUE(bridge()->ShouldSyncVisit(MakeUrlRow(20, 20), - ui::PAGE_TRANSITION_TYPED)); - } -} - -} // namespace history diff --git a/chromium_src/components/history/core/browser/sync/chromium_typed_url_sync_bridge_unittest.cc b/chromium_src/components/history/core/browser/sync/chromium_typed_url_sync_bridge_unittest.cc deleted file mode 100644 index 239d758979bd..000000000000 --- a/chromium_src/components/history/core/browser/sync/chromium_typed_url_sync_bridge_unittest.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include - -#include "base/test/scoped_feature_list.h" -#include "brave/components/brave_sync/features.h" -#include "brave/components/history/core/browser/sync/brave_typed_url_sync_bridge.h" -#include "components/history/core/browser/sync/typed_url_sync_bridge.h" -#include "components/sync/model/model_type_sync_bridge.h" - -#define BRAVE_TEST_MEMBERS_DECLARE \ - base::test::ScopedFeatureList scoped_feature_list_; - -#define BRAVE_TEST_MEMBERS_INIT \ - scoped_feature_list_.InitWithFeatures( \ - {}, {brave_sync::features::kBraveSyncSendAllHistory}); - -#define TypedURLSyncBridge BraveTypedURLSyncBridge - -#include "src/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc" - -#undef TypedURLSyncBridge - -#undef BRAVE_TEST_MEMBERS_INIT -#undef BRAVE_TEST_MEMBERS_DECLARE diff --git a/chromium_src/components/history/core/browser/sync/delete_directive_handler.cc b/chromium_src/components/history/core/browser/sync/delete_directive_handler.cc new file mode 100644 index 000000000000..3cd07b2061b5 --- /dev/null +++ b/chromium_src/components/history/core/browser/sync/delete_directive_handler.cc @@ -0,0 +1,18 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "components/history/core/browser/sync/delete_directive_handler.h" + +#define CreateUrlDeleteDirective CreateUrlDeleteDirective_ChromiumImpl +#include "src/components/history/core/browser/sync/delete_directive_handler.cc" +#undef CreateUrlDeleteDirective + +namespace history { + +bool DeleteDirectiveHandler::CreateUrlDeleteDirective(const GURL& url) { + return false; +} + +} // namespace history diff --git a/chromium_src/components/history/core/browser/sync/delete_directive_handler.h b/chromium_src/components/history/core/browser/sync/delete_directive_handler.h new file mode 100644 index 000000000000..83c48554e52f --- /dev/null +++ b/chromium_src/components/history/core/browser/sync/delete_directive_handler.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_ +#define BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_ + +#define CreateTimeRangeDeleteDirective \ + CreateUrlDeleteDirective_ChromiumImpl(const GURL& url); \ + bool CreateTimeRangeDeleteDirective + +#include "src/components/history/core/browser/sync/delete_directive_handler.h" // IWYU pragma: export + +#undef CreateTimeRangeDeleteDirective + +#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_ diff --git a/chromium_src/components/history/core/browser/sync/delete_directive_handler_unittest.cc b/chromium_src/components/history/core/browser/sync/delete_directive_handler_unittest.cc new file mode 100644 index 000000000000..565c8fe49d43 --- /dev/null +++ b/chromium_src/components/history/core/browser/sync/delete_directive_handler_unittest.cc @@ -0,0 +1,17 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "src/components/history/core/browser/sync/delete_directive_handler_unittest.cc" + +namespace history { +namespace { + +TEST_F(HistoryDeleteDirectiveHandlerTest, + BraveCreateUrlDeleteDirectiveReturnsFalse) { + EXPECT_FALSE(handler()->CreateUrlDeleteDirective(GURL("https://brave.com"))); +} + +} // namespace +} // namespace history diff --git a/chromium_src/components/history/core/browser/sync/typed_url_sync_bridge.cc b/chromium_src/components/history/core/browser/sync/typed_url_sync_bridge.cc deleted file mode 100644 index d1209469b526..000000000000 --- a/chromium_src/components/history/core/browser/sync/typed_url_sync_bridge.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "components/history/core/browser/sync/typed_url_sync_bridge.h" - -#include "brave/components/brave_sync/features.h" -#include "ui/base/page_transition_types.h" - -namespace { - -bool IsSendAllHistoryEnabled() { - return base::FeatureList::IsEnabled( - brave_sync::features::kBraveSyncSendAllHistory); -} - -} // namespace - -// } // namespace ui - -#define BRAVE_TYPED_URL_SYNC_BRIDGE_ON_URL_VISITED_REPLACE_SHOULD_SYNC_VISIT \ - if (!ShouldSyncVisit(url_row, visit_row.transition)) { \ - return; \ - } \ - /* Suppress cpplint error: (cpplint) If/else bodies with multiple */ \ - /* statements require braces [readability/braces] [4] */ \ - /* NOLINTNEXTLINE */ \ - if (false) - -#include "src/components/history/core/browser/sync/typed_url_sync_bridge.cc" - -#undef BRAVE_TYPED_URL_SYNC_BRIDGE_ON_URL_VISITED_REPLACE_SHOULD_SYNC_VISIT - -namespace history { - -// static -bool TypedURLSyncBridge::HasTypedUrl(const std::vector& visits) { - if (IsSendAllHistoryEnabled()) { - // We are ignoring only reload transitions, so any other like typed, - // link, bookmark - are accepted as worth to be synced. - return base::ranges::any_of(visits, [](const VisitRow& visit) { - return !ui::PageTransitionCoreTypeIs(visit.transition, - ui::PAGE_TRANSITION_RELOAD); - }); - } - return ::history::HasTypedUrl(visits); -} - -} // namespace history diff --git a/chromium_src/components/history/core/browser/sync/typed_url_sync_bridge.h b/chromium_src/components/history/core/browser/sync/typed_url_sync_bridge.h deleted file mode 100644 index ebe52b14940f..000000000000 --- a/chromium_src/components/history/core/browser/sync/typed_url_sync_bridge.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_TYPED_URL_SYNC_BRIDGE_H_ -#define BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_TYPED_URL_SYNC_BRIDGE_H_ - -#define ShouldSyncVisit \ - ShouldSyncVisitUnused(); \ - static bool HasTypedUrl(const std::vector& visits); \ - virtual bool ShouldSyncVisit(const URLRow& url_row, \ - ui::PageTransition transition) = 0; \ - friend class BraveTypedURLSyncBridge; \ - friend class BraveTypedURLSyncBridgeTest; \ - bool ShouldSyncVisit - -#include "src/components/history/core/browser/sync/typed_url_sync_bridge.h" // IWYU pragma: export - -#undef ShouldSyncVisit - -#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_TYPED_URL_SYNC_BRIDGE_H_ diff --git a/chromium_src/components/sync/base/features.cc b/chromium_src/components/sync/base/features.cc deleted file mode 100644 index b71d4996d54a..000000000000 --- a/chromium_src/components/sync/base/features.cc +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "src/components/sync/base/features.cc" - -#include "base/feature_override.h" - -namespace syncer { - -OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kSyncEnableHistoryDataType, base::FEATURE_DISABLED_BY_DEFAULT}, -}}); - -} // namespace syncer diff --git a/chromium_src/components/sync/base/model_type.cc b/chromium_src/components/sync/base/model_type.cc index 42544fa0e299..5507e43be820 100644 --- a/chromium_src/components/sync/base/model_type.cc +++ b/chromium_src/components/sync/base/model_type.cc @@ -14,6 +14,7 @@ ModelTypeSet EncryptableUserTypes() { ModelTypeSet encryptable_user_types = EncryptableUserTypes_ChromiumImpl(); // Brave sync has encryption setup ready when sync chain created encryptable_user_types.Put(DEVICE_INFO); + encryptable_user_types.Put(HISTORY); return encryptable_user_types; } diff --git a/chromium_src/components/sync/base/model_type.h b/chromium_src/components/sync/base/model_type.h new file mode 100644 index 000000000000..8cf19a3bfe0e --- /dev/null +++ b/chromium_src/components/sync/base/model_type.h @@ -0,0 +1,32 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ +#define BRAVE_CHROMIUM_SRC_COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ + +#define LowPriorityUserTypes LowPriorityUserTypes_ChromiumImpl + +#include "src/components/sync/base/model_type.h" // IWYU pragma: export + +#undef LowPriorityUserTypes + +namespace syncer { + +constexpr ModelTypeSet LowPriorityUserTypes() { + auto low_priority_user_types = LowPriorityUserTypes_ChromiumImpl(); + // Directives must be synced after history entities. If + // history delete directives are processed before retrieving history upon + // initial sync, relevant entries will not be deleted. + // This override must be reverted when + // https://github.com/brave/go-sync/issues/178 will be solved. + low_priority_user_types.Remove(HISTORY); + low_priority_user_types.Put(HISTORY_DELETE_DIRECTIVES); + + return low_priority_user_types; +} + +} // namespace syncer + +#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ diff --git a/chromium_src/components/sync/base/model_type_unittest.cc b/chromium_src/components/sync/base/model_type_unittest.cc index c7f0557550da..be67a6d8279e 100644 --- a/chromium_src/components/sync/base/model_type_unittest.cc +++ b/chromium_src/components/sync/base/model_type_unittest.cc @@ -10,6 +10,13 @@ namespace { TEST_F(ModelTypeTest, EncryptableUserTypes) { EXPECT_TRUE(EncryptableUserTypes().Has(DEVICE_INFO)); + EXPECT_TRUE(EncryptableUserTypes().Has(HISTORY)); +} + +TEST_F(ModelTypeTest, LowPriorityUserTypes) { + EXPECT_TRUE(LowPriorityUserTypes().Has(HISTORY_DELETE_DIRECTIVES)); + EXPECT_FALSE(LowPriorityUserTypes().Has(HISTORY)); + EXPECT_TRUE(LowPriorityUserTypes().Has(USER_EVENTS)); } // This test is supposed to fail when sync types are increased/decreased diff --git a/components/brave_sync/features.cc b/components/brave_sync/features.cc index 83a1944b9d66..853473dec423 100644 --- a/components/brave_sync/features.cc +++ b/components/brave_sync/features.cc @@ -12,21 +12,5 @@ namespace features { BASE_FEATURE(kBraveSync, "BraveSync", base::FEATURE_ENABLED_BY_DEFAULT); -// When this feature is enabled through brave://flags it adds to history entry's -// title additional info for sync diagnostics: -// - whether history entry should be synced; -// - typed count; -// - page transition. -BASE_FEATURE(kBraveSyncHistoryDiagnostics, - "BraveSyncHistoryDiagnostics", - base::FEATURE_DISABLED_BY_DEFAULT); - -// When this feature is enabled, Sync sends to remote server all the history -// entries, including page transition beyond typed url (link, bookmark, reload, -// etc). -BASE_FEATURE(kBraveSyncSendAllHistory, - "BraveSyncSendAllHistory", - base::FEATURE_DISABLED_BY_DEFAULT); - } // namespace features } // namespace brave_sync diff --git a/components/brave_sync/features.h b/components/brave_sync/features.h index 5fa00d9c84fa..11db015866df 100644 --- a/components/brave_sync/features.h +++ b/components/brave_sync/features.h @@ -13,10 +13,6 @@ namespace features { BASE_DECLARE_FEATURE(kBraveSync); -BASE_DECLARE_FEATURE(kBraveSyncHistoryDiagnostics); - -BASE_DECLARE_FEATURE(kBraveSyncSendAllHistory); - } // namespace features } // namespace brave_sync diff --git a/components/history/core/browser/sources.gni b/components/history/core/browser/sources.gni index 4a584cda68fc..655322363fa1 100644 --- a/components/history/core/browser/sources.gni +++ b/components/history/core/browser/sources.gni @@ -4,9 +4,10 @@ # You can obtain one at https://mozilla.org/MPL/2.0/. brave_components_history_core_browser_sources = [ - "//brave/components/history/core/browser/sync/brave_typed_url_sync_bridge.cc", - "//brave/components/history/core/browser/sync/brave_typed_url_sync_bridge.h", + "//brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.cc", + "//brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h", + "//brave/components/history/core/browser/sync/brave_history_model_type_controller.cc", + "//brave/components/history/core/browser/sync/brave_history_model_type_controller.h", ] -brave_components_history_core_browser_deps = - [ "//brave/components/brave_sync:features" ] +brave_components_history_core_browser_deps = [] diff --git a/components/history/core/browser/sync/BUILD.gn b/components/history/core/browser/sync/BUILD.gn new file mode 100644 index 000000000000..b6e0f8bb22dc --- /dev/null +++ b/components/history/core/browser/sync/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at https://mozilla.org/MPL/2.0/. + +source_set("unit_tests") { + testonly = true + sources = [ "//components/history/core/browser/sync/delete_directive_handler_unittest.cc" ] + deps = [ + "//base", + "//base/test:test_support", + "//components/history/core/browser:browser", + "//components/history/core/common", + "//components/history/core/test", + "//components/prefs:test_support", + "//components/sync", + "//components/sync:test_support", + "//testing/gtest", + "//url", + ] +} diff --git a/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.cc b/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.cc new file mode 100644 index 000000000000..5a97bef79c95 --- /dev/null +++ b/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.cc @@ -0,0 +1,34 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h" + +#include "components/history/core/browser/sync/history_delete_directives_model_type_controller.h" + +namespace history { + +BraveHistoryDeleteDirectivesModelTypeController:: + BraveHistoryDeleteDirectivesModelTypeController( + const base::RepeatingClosure& dump_stack, + syncer::SyncService* sync_service, + syncer::ModelTypeStoreService* model_type_store_service, + HistoryService* history_service, + PrefService* pref_service) + : HistoryDeleteDirectivesModelTypeController(dump_stack, + sync_service, + model_type_store_service, + history_service, + pref_service) {} + +BraveHistoryDeleteDirectivesModelTypeController:: + ~BraveHistoryDeleteDirectivesModelTypeController() = default; + +syncer::DataTypeController::PreconditionState +BraveHistoryDeleteDirectivesModelTypeController::GetPreconditionState() const { + DCHECK(CalledOnValidThread()); + return PreconditionState::kPreconditionsMet; +} + +} // namespace history diff --git a/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h b/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h new file mode 100644 index 000000000000..a2b8e6f97e4f --- /dev/null +++ b/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_ +#define BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_ + +#include "base/functional/callback_forward.h" +#include "components/history/core/browser/sync/history_delete_directives_model_type_controller.h" +#include "components/sync/service/data_type_controller.h" + +class PrefService; + +namespace syncer { +class ModelTypeStoreService; +class SyncService; +} // namespace syncer + +namespace history { + +class BraveHistoryDeleteDirectivesModelTypeController + : public HistoryDeleteDirectivesModelTypeController { + public: + BraveHistoryDeleteDirectivesModelTypeController( + const base::RepeatingClosure& dump_stack, + syncer::SyncService* sync_service, + syncer::ModelTypeStoreService* model_type_store_service, + HistoryService* history_service, + PrefService* pref_service); + + BraveHistoryDeleteDirectivesModelTypeController( + const BraveHistoryDeleteDirectivesModelTypeController&) = delete; + BraveHistoryDeleteDirectivesModelTypeController& operator=( + const BraveHistoryDeleteDirectivesModelTypeController&) = delete; + + ~BraveHistoryDeleteDirectivesModelTypeController() override; + + // DataTypeController overrides. + PreconditionState GetPreconditionState() const override; +}; + +} // namespace history + +#endif // BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_ diff --git a/components/history/core/browser/sync/brave_history_model_type_controller.cc b/components/history/core/browser/sync/brave_history_model_type_controller.cc new file mode 100644 index 000000000000..0c748cebd4f9 --- /dev/null +++ b/components/history/core/browser/sync/brave_history_model_type_controller.cc @@ -0,0 +1,42 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "brave/components/history/core/browser/sync/brave_history_model_type_controller.h" + +#include "base/feature_list.h" +#include "components/sync/base/features.h" + +namespace history { + +BraveHistoryModelTypeController::BraveHistoryModelTypeController( + syncer::ModelType model_type, + syncer::SyncService* sync_service, + signin::IdentityManager* identity_manager, + HistoryService* history_service, + PrefService* pref_service) + : HistoryModelTypeController(model_type, + sync_service, + identity_manager, + history_service, + pref_service) {} + +BraveHistoryModelTypeController::~BraveHistoryModelTypeController() = default; + +syncer::DataTypeController::PreconditionState +BraveHistoryModelTypeController::GetPreconditionState() const { + if (!base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { + DCHECK_EQ(type(), syncer::TYPED_URLS); + return HistoryModelTypeController::GetPreconditionState(); + } + + // If the History feature flag is enabled, HISTORY replaces TYPED_URLS. + if (type() == syncer::TYPED_URLS) { + return PreconditionState::kMustStopAndClearData; + } + DCHECK_EQ(type(), syncer::HISTORY); + return PreconditionState::kPreconditionsMet; +} + +} // namespace history diff --git a/components/history/core/browser/sync/brave_history_model_type_controller.h b/components/history/core/browser/sync/brave_history_model_type_controller.h new file mode 100644 index 000000000000..230d87851204 --- /dev/null +++ b/components/history/core/browser/sync/brave_history_model_type_controller.h @@ -0,0 +1,49 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_HISTORY_MODEL_TYPE_CONTROLLER_H_ +#define BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_HISTORY_MODEL_TYPE_CONTROLLER_H_ + +#include "components/history/core/browser/sync/history_model_type_controller.h" +#include "components/sync/base/model_type.h" + +class PrefService; + +namespace signin { +// class AccountManagedStatusFinder; +class IdentityManager; +} // namespace signin + +namespace syncer { +// class ModelTypeStoreService; +class SyncService; +} // namespace syncer + +namespace history { + +class HistoryService; + +class BraveHistoryModelTypeController : public HistoryModelTypeController { + public: + BraveHistoryModelTypeController(syncer::ModelType model_type, + syncer::SyncService* sync_service, + signin::IdentityManager* identity_manager, + HistoryService* history_service, + PrefService* pref_service); + + BraveHistoryModelTypeController(const BraveHistoryModelTypeController&) = + delete; + BraveHistoryModelTypeController& operator=( + const BraveHistoryModelTypeController&) = delete; + + ~BraveHistoryModelTypeController() override; + + // syncer::DataTypeController implementation. + PreconditionState GetPreconditionState() const override; +}; + +} // namespace history + +#endif // BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_HISTORY_MODEL_TYPE_CONTROLLER_H_ diff --git a/components/history/core/browser/sync/brave_typed_url_sync_bridge.cc b/components/history/core/browser/sync/brave_typed_url_sync_bridge.cc deleted file mode 100644 index 57c161eed780..000000000000 --- a/components/history/core/browser/sync/brave_typed_url_sync_bridge.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "brave/components/history/core/browser/sync/brave_typed_url_sync_bridge.h" - -#include -#include - -#include "brave/components/brave_sync/features.h" - -namespace history { - -// For the case when kBraveSyncSendAllHistory feature is enabled, -// we want to send to the sync server first 20 visits and then each 10th -namespace { -const int kSendAllFlagVisitThrottleThreshold = 20; -const int kSendAllFlagVisitThrottleMultiple = 10; -} // namespace - -BraveTypedURLSyncBridge::BraveTypedURLSyncBridge( - HistoryBackend* history_backend, - TypedURLSyncMetadataDatabase* sync_metadata_store, - std::unique_ptr change_processor) - : TypedURLSyncBridge(history_backend, - sync_metadata_store, - std::move(change_processor)) {} - -bool BraveTypedURLSyncBridge::ShouldSyncVisit(const URLRow& url_row, - ui::PageTransition transition) { - if (base::FeatureList::IsEnabled( - brave_sync::features::kBraveSyncSendAllHistory)) { - return url_row.visit_count() < kSendAllFlagVisitThrottleThreshold || - (url_row.visit_count() % kSendAllFlagVisitThrottleMultiple) == 0; - } - return TypedURLSyncBridge::ShouldSyncVisit(url_row.typed_count(), transition); -} - -int BraveTypedURLSyncBridge::GetSendAllFlagVisitThrottleThreshold() { - return kSendAllFlagVisitThrottleThreshold; -} - -int BraveTypedURLSyncBridge::GetSendAllFlagVisitThrottleMultiple() { - return kSendAllFlagVisitThrottleMultiple; -} - -} // namespace history diff --git a/components/history/core/browser/sync/brave_typed_url_sync_bridge.h b/components/history/core/browser/sync/brave_typed_url_sync_bridge.h deleted file mode 100644 index 47a67bb186f2..000000000000 --- a/components/history/core/browser/sync/brave_typed_url_sync_bridge.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_TYPED_URL_SYNC_BRIDGE_H_ -#define BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_TYPED_URL_SYNC_BRIDGE_H_ - -#include - -#include "components/history/core/browser/sync/typed_url_sync_bridge.h" - -namespace history { - -class BraveTypedURLSyncBridge : public TypedURLSyncBridge { - public: - BraveTypedURLSyncBridge( - HistoryBackend* history_backend, - TypedURLSyncMetadataDatabase* sync_metadata_store, - std::unique_ptr change_processor); - - BraveTypedURLSyncBridge(const BraveTypedURLSyncBridge&) = delete; - BraveTypedURLSyncBridge& operator=(const BraveTypedURLSyncBridge&) = delete; - - ~BraveTypedURLSyncBridge() override = default; - bool ShouldSyncVisit(const URLRow& url_row, - ui::PageTransition transition) override; - - static int GetSendAllFlagVisitThrottleThreshold(); - static int GetSendAllFlagVisitThrottleMultiple(); - - private: - friend class BraveTypedURLSyncBridgeTest; -}; - -} // namespace history - -#endif // BRAVE_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_BRAVE_TYPED_URL_SYNC_BRIDGE_H_ diff --git a/components/sync/service/BUILD.gn b/components/sync/service/BUILD.gn index 34b619a12b70..b1fc73c29a58 100644 --- a/components/sync/service/BUILD.gn +++ b/components/sync/service/BUILD.gn @@ -23,6 +23,7 @@ source_set("unit_tests") { "//brave/components/brave_sync:prefs", "//brave/components/constants", "//brave/components/sync/test:test_support", + "//components/history/core/browser:browser", "//components/os_crypt/sync:os_crypt", "//components/os_crypt/sync:test_support", "//components/prefs:prefs", diff --git a/components/sync/service/brave_sync_service_impl.h b/components/sync/service/brave_sync_service_impl.h index 75a1c0fbcb2a..07b1ae16033c 100644 --- a/components/sync/service/brave_sync_service_impl.h +++ b/components/sync/service/brave_sync_service_impl.h @@ -76,6 +76,7 @@ class BraveSyncServiceImpl : public SyncServiceImpl { OnAccountDeleted_FailureAndRetry); FRIEND_TEST_ALL_PREFIXES(BraveSyncServiceImplTest, JoinActiveOrNewChain); FRIEND_TEST_ALL_PREFIXES(BraveSyncServiceImplTest, JoinDeletedChain); + FRIEND_TEST_ALL_PREFIXES(BraveSyncServiceImplTest, HistoryPreconditions); BraveSyncAuthManager* GetBraveSyncAuthManager(); SyncServiceCrypto* GetCryptoForTests(); diff --git a/components/sync/service/brave_sync_service_impl_unittest.cc b/components/sync/service/brave_sync_service_impl_unittest.cc index 6aae971436fd..01e57929222c 100644 --- a/components/sync/service/brave_sync_service_impl_unittest.cc +++ b/components/sync/service/brave_sync_service_impl_unittest.cc @@ -9,6 +9,8 @@ #include "base/logging.h" #include "base/test/gtest_util.h" #include "base/test/task_environment.h" +#include "brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h" +#include "brave/components/history/core/browser/sync/brave_history_model_type_controller.h" #include "brave/components/sync/service/brave_sync_service_impl.h" #include "brave/components/sync/service/sync_service_impl_delegate.h" #include "brave/components/sync/test/brave_mock_sync_engine.h" @@ -24,6 +26,7 @@ #include "components/sync/test/fake_sync_engine.h" #include "components/sync/test/fake_sync_manager.h" #include "components/sync/test/sync_service_impl_bundle.h" +#include "components/sync/test/test_model_type_store_service.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -132,6 +135,10 @@ class BraveSyncServiceImplTest : public testing::Test { return component_factory()->last_created_engine(); } + signin::IdentityManager* identity_manager() { + return sync_service_impl_bundle_.identity_manager(); + } + protected: content::BrowserTaskEnvironment task_environment_; @@ -489,4 +496,62 @@ TEST_F(BraveSyncServiceImplTest, JoinDeletedChain) { OSCryptMocker::TearDown(); } +TEST_F(BraveSyncServiceImplTest, HistoryPreconditions) { + // This test ensures that BraveHistoryModelTypeController and + // BraveHistoryDeleteDirectivesModelTypeController allow to run if + // IsEncryptEverythingEnabled is set to true; upstream doesn't allow + // History sync when encrypt everything is set to true. + // The test is placed here alongside BraveSyncServiceImplTest because + // here is the infrastructure which allows implement it. + // Otherwise TestSyncUserSettings would not allow to override + // IsEncryptEverythingEnabled. + + OSCryptMocker::SetUp(); + CreateSyncService(); + + brave_sync_service_impl()->Initialize(); + EXPECT_FALSE(engine()); + brave_sync_service_impl()->SetSyncCode(kValidSyncCode); + task_environment_.RunUntilIdle(); + + brave_sync_service_impl() + ->GetUserSettings() + ->SetInitialSyncFeatureSetupComplete( + syncer::SyncFirstSetupCompleteSource::ADVANCED_FLOW_CONFIRM); + EXPECT_TRUE(engine()); + + // Code below turns on encrypt everything + brave_sync_service_impl()->GetCryptoForTests()->OnEncryptedTypesChanged( + AlwaysEncryptedUserTypes(), true); + + // Ensure encrypt everything was actually enabled + EXPECT_TRUE(brave_sync_service_impl() + ->GetUserSettings() + ->IsEncryptEverythingEnabled()); + + auto history_model_type_controller = + std::make_unique( + HISTORY, brave_sync_service_impl(), identity_manager(), nullptr, + pref_service()); + + auto history_precondition_state = + history_model_type_controller->GetPreconditionState(); + EXPECT_EQ(history_precondition_state, + DataTypeController::PreconditionState::kPreconditionsMet); + + auto test_model_type_store_service = + std::make_unique(); + auto history_delete_directives_model_type_controller = std::make_unique< + history::BraveHistoryDeleteDirectivesModelTypeController>( + base::DoNothing(), brave_sync_service_impl(), + test_model_type_store_service.get(), nullptr, pref_service()); + + auto history_delete_directives_precondition_state = + history_delete_directives_model_type_controller->GetPreconditionState(); + EXPECT_EQ(history_delete_directives_precondition_state, + DataTypeController::PreconditionState::kPreconditionsMet); + + OSCryptMocker::TearDown(); +} + } // namespace syncer diff --git a/components/sync/sources.gni b/components/sync/sources.gni deleted file mode 100644 index d6eefad2ae1f..000000000000 --- a/components/sync/sources.gni +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 The Brave Authors. All rights reserved. -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at https://mozilla.org/MPL/2.0/. - -brave_components_sync_deps = [ "//brave/components/brave_sync:features" ] diff --git a/patches/components-history-core-browser-sync-typed_url_sync_bridge.cc.patch b/patches/components-history-core-browser-sync-typed_url_sync_bridge.cc.patch deleted file mode 100644 index 590e52e3c710..000000000000 --- a/patches/components-history-core-browser-sync-typed_url_sync_bridge.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/components/history/core/browser/sync/typed_url_sync_bridge.cc b/components/history/core/browser/sync/typed_url_sync_bridge.cc -index ecd3234b3bf1c42a195fec3b60901b1a6402b4da..ef9ca6323efa01582436a7d2cf51b3227d6c0c9b 100644 ---- a/components/history/core/browser/sync/typed_url_sync_bridge.cc -+++ b/components/history/core/browser/sync/typed_url_sync_bridge.cc -@@ -386,6 +386,7 @@ void TypedURLSyncBridge::OnURLVisited(HistoryBackend* history_backend, - if (!change_processor()->IsTrackingMetadata()) { - return; // Sync processor not yet ready, don't sync. - } -+ BRAVE_TYPED_URL_SYNC_BRIDGE_ON_URL_VISITED_REPLACE_SHOULD_SYNC_VISIT - if (!ShouldSyncVisit(url_row.typed_count(), visit_row.transition)) { - return; - } diff --git a/patches/components-history-core-browser-sync-typed_url_sync_bridge_unittest.cc.patch b/patches/components-history-core-browser-sync-typed_url_sync_bridge_unittest.cc.patch deleted file mode 100644 index 4f86ea7dd416..000000000000 --- a/patches/components-history-core-browser-sync-typed_url_sync_bridge_unittest.cc.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc b/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc -index b396a2de48c821dcee672403709a179021cbe601..c223995a7a7920c8794fae293e32defb463070be 100644 ---- a/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc -+++ b/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc -@@ -347,6 +347,7 @@ class TypedURLSyncBridgeTest : public testing::Test { - typed_url_sync_bridge_->Init(); - typed_url_sync_bridge_->history_backend_observation_.Reset(); - fake_history_backend_->SetTypedURLSyncBridgeForTest(std::move(bridge)); -+ BRAVE_TEST_MEMBERS_INIT - } - - void TearDown() override { fake_history_backend_->Closing(); } -@@ -554,6 +555,7 @@ class TypedURLSyncBridgeTest : public testing::Test { - scoped_refptr fake_history_backend_; - raw_ptr typed_url_sync_bridge_ = nullptr; - NiceMock mock_processor_; -+ BRAVE_TEST_MEMBERS_DECLARE - }; - - // Add two typed urls locally and verify bridge can get them from GetAllData. diff --git a/patches/components-sync-BUILD.gn.patch b/patches/components-sync-BUILD.gn.patch deleted file mode 100644 index 96e8100d3c71..000000000000 --- a/patches/components-sync-BUILD.gn.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn -index 62d18bc96a386992cde393add46748bcab29c0e4..a067524c9ca3293cae04f9219b0c94cb8919c480 100644 ---- a/components/sync/BUILD.gn -+++ b/components/sync/BUILD.gn -@@ -16,6 +16,7 @@ group("sync") { - if (is_chromeos) { - public_deps += [ "//components/sync/chromeos" ] - } -+ import("//brave/build/config/brave_build.gni") public_deps += brave_components_sync_deps - } - - static_library("test_support") { diff --git a/test/BUILD.gn b/test/BUILD.gn index 05d33f7f4b24..fca8604830ed 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -109,8 +109,6 @@ test("brave_unit_tests") { "//brave/chromium_src/chrome/browser/lookalikes/lookalike_url_navigation_throttle_unittest.cc", "//brave/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc", "//brave/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc", - "//brave/chromium_src/components/history/core/browser/sync/brave_typed_url_sync_bridge_unittest.cc", - "//brave/chromium_src/components/history/core/browser/sync/chromium_typed_url_sync_bridge_unittest.cc", "//brave/chromium_src/components/variations/service/field_trial_unittest.cc", "//brave/chromium_src/net/cookies/brave_canonical_cookie_unittest.cc", "//brave/chromium_src/services/network/public/cpp/cors/cors_unittest.cc", @@ -237,6 +235,7 @@ test("brave_unit_tests") { "//brave/components/de_amp/browser/test:unit_tests", "//brave/components/debounce/browser/test:unit_tests", "//brave/components/embedder_support:unit_tests", + "//brave/components/history/core/browser/sync:unit_tests", "//brave/components/ipfs/buildflags", "//brave/components/ipfs/test:brave_ipfs_unit_tests", "//brave/components/json:brave_json_unit_tests",