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 index 5eb8be2aa1b4..565c8fe49d43 100644 --- 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 @@ -8,33 +8,9 @@ namespace history { namespace { -// Check if patch for DeleteDirectiveHandler::CreateUrlDeleteDirective works. -// Create UrlDeleteDirective and ensure that url is in fact empty. TEST_F(HistoryDeleteDirectiveHandlerTest, - BraveCreateUrlDeleteDirectiveOmitsUrl) { - syncer::FakeSyncChangeProcessor change_processor; - - EXPECT_FALSE( - handler() - ->MergeDataAndStartSyncing( - syncer::HISTORY_DELETE_DIRECTIVES, syncer::SyncDataList(), - std::make_unique( - &change_processor)) - .has_value()); - - bool create_directive_result = - handler()->CreateUrlDeleteDirective(GURL("https://brave.com")); - EXPECT_TRUE(create_directive_result); - - ASSERT_EQ(1u, change_processor.changes().size()); - - const auto& specifics = - change_processor.changes()[0].sync_data().GetSpecifics(); - ASSERT_TRUE(specifics.has_history_delete_directive()); - const auto& history_delete_directive = specifics.history_delete_directive(); - ASSERT_TRUE(history_delete_directive.has_url_directive()); - EXPECT_FALSE(history_delete_directive.url_directive().has_url()); - EXPECT_EQ(history_delete_directive.url_directive().url(), std::string()); + BraveCreateUrlDeleteDirectiveReturnsFalse) { + EXPECT_FALSE(handler()->CreateUrlDeleteDirective(GURL("https://brave.com"))); } } // namespace diff --git a/patches/components-history-core-browser-sync-delete_directive_handler.cc.patch b/patches/components-history-core-browser-sync-delete_directive_handler.cc.patch deleted file mode 100644 index 0059c3bf74f9..000000000000 --- a/patches/components-history-core-browser-sync-delete_directive_handler.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/components/history/core/browser/sync/delete_directive_handler.cc b/components/history/core/browser/sync/delete_directive_handler.cc -index aed3aec1f04f15f9f806887110d87abac9ef06ba..13053b7fe8a0281e3f9d9f69b58bf35e5d199e2e 100644 ---- a/components/history/core/browser/sync/delete_directive_handler.cc -+++ b/components/history/core/browser/sync/delete_directive_handler.cc -@@ -387,7 +387,6 @@ bool DeleteDirectiveHandler::CreateUrlDeleteDirective(const GURL& url) { - - sync_pb::UrlDirective* url_directive = - delete_directive.mutable_url_directive(); -- url_directive->set_url(url.spec()); - url_directive->set_end_time_usec(TimeToUnixUsec(base::Time::Now())); - - absl::optional error =