From d9894b27223b250de6cb602786b59e9f8f1b3cf7 Mon Sep 17 00:00:00 2001 From: brave-builds Date: Thu, 6 Aug 2020 22:43:49 +0000 Subject: [PATCH] Uplift of #6363 (squashed) to beta --- build/config/brave_build.gni | 1 + .../sync/engine/sync_manager_factory.cc | 10 +++++++ .../engine_impl/brave_sync_manager_impl.cc | 24 +++++++++++++++ .../engine_impl/brave_sync_manager_impl.h | 30 +++++++++++++++++++ components/sync/sources.gni | 9 ++++++ patches/components-sync-BUILD.gn.patch | 12 ++++++++ 6 files changed, 86 insertions(+) create mode 100644 chromium_src/components/sync/engine/sync_manager_factory.cc create mode 100644 components/sync/engine_impl/brave_sync_manager_impl.cc create mode 100644 components/sync/engine_impl/brave_sync_manager_impl.h create mode 100644 components/sync/sources.gni create mode 100644 patches/components-sync-BUILD.gn.patch diff --git a/build/config/brave_build.gni b/build/config/brave_build.gni index fcb2fc2f721b..3ab7ad133dd6 100644 --- a/build/config/brave_build.gni +++ b/build/config/brave_build.gni @@ -4,6 +4,7 @@ import("//brave/brave_repack_locales.gni") import("//brave/build/config/compiler.gni") import("//brave/build/features.gni") +import("//brave/components/sync/sources.gni") import("//brave/components/sync/driver/sources.gni") import("//brave/net/sources.gni") import("//brave/third_party/blink/renderer/includes.gni") diff --git a/chromium_src/components/sync/engine/sync_manager_factory.cc b/chromium_src/components/sync/engine/sync_manager_factory.cc new file mode 100644 index 000000000000..18cded8cac53 --- /dev/null +++ b/chromium_src/components/sync/engine/sync_manager_factory.cc @@ -0,0 +1,10 @@ +/* Copyright (c) 2020 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 http://mozilla.org/MPL/2.0/. */ + +#include "brave/components/sync/engine_impl/brave_sync_manager_impl.h" + +#define SyncManagerImpl BraveSyncManagerImpl +#include "../../../../../components/sync/engine/sync_manager_factory.cc" +#undef SyncManagerImpl diff --git a/components/sync/engine_impl/brave_sync_manager_impl.cc b/components/sync/engine_impl/brave_sync_manager_impl.cc new file mode 100644 index 000000000000..9263a7814c07 --- /dev/null +++ b/components/sync/engine_impl/brave_sync_manager_impl.cc @@ -0,0 +1,24 @@ +/* Copyright (c) 2020 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 http://mozilla.org/MPL/2.0/. */ + +#include "brave/components/sync/engine_impl/brave_sync_manager_impl.h" + +namespace syncer { + +BraveSyncManagerImpl::BraveSyncManagerImpl( + const std::string& name, + network::NetworkConnectionTracker* network_connection_tracker) + : SyncManagerImpl(name, network_connection_tracker) {} + +BraveSyncManagerImpl::~BraveSyncManagerImpl() {} + +void BraveSyncManagerImpl::StartSyncingNormally(base::Time last_poll_time) { + SyncManagerImpl::StartSyncingNormally(last_poll_time); + // Remove this hack when we have FCM invalidation integrated. + // We only enable BOOKMARKS by default so only force refresh it + RefreshTypes(ModelTypeSet(BOOKMARKS)); +} + +} // namespace syncer diff --git a/components/sync/engine_impl/brave_sync_manager_impl.h b/components/sync/engine_impl/brave_sync_manager_impl.h new file mode 100644 index 000000000000..957cccc422a8 --- /dev/null +++ b/components/sync/engine_impl/brave_sync_manager_impl.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2020 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 http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_COMPONENTS_SYNC_ENGINE_IMPL_BRAVE_SYNC_MANAGER_IMPL_H_ +#define BRAVE_COMPONENTS_SYNC_ENGINE_IMPL_BRAVE_SYNC_MANAGER_IMPL_H_ + +#include + +#include "components/sync/engine_impl/sync_manager_impl.h" + +namespace syncer { + +class BraveSyncManagerImpl : public SyncManagerImpl { + public: + BraveSyncManagerImpl( + const std::string& name, + network::NetworkConnectionTracker* network_connection_tracker); + ~BraveSyncManagerImpl() override; + + void StartSyncingNormally(base::Time last_poll_time) override; + + private: + DISALLOW_COPY_AND_ASSIGN(BraveSyncManagerImpl); +}; + +} // namespace syncer + +#endif // BRAVE_COMPONENTS_SYNC_ENGINE_IMPL_BRAVE_SYNC_MANAGER_IMPL_H_ diff --git a/components/sync/sources.gni b/components/sync/sources.gni new file mode 100644 index 000000000000..c699610b21c5 --- /dev/null +++ b/components/sync/sources.gni @@ -0,0 +1,9 @@ +# Copyright (c) 2020 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 http://mozilla.org/MPL/2.0/. + +brave_components_sync_sources = [ + "//brave/components/sync/engine_impl/brave_sync_manager_impl.cc", + "//brave/components/sync/engine_impl/brave_sync_manager_impl.h", +] diff --git a/patches/components-sync-BUILD.gn.patch b/patches/components-sync-BUILD.gn.patch new file mode 100644 index 000000000000..76dad9274cd9 --- /dev/null +++ b/patches/components-sync-BUILD.gn.patch @@ -0,0 +1,12 @@ +diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn +index db5a9d0154d0c1e1390e4af6272d7d6cebe24b57..3cde948c91c4aa13297de70dafa86ee33db32906 100644 +--- a/components/sync/BUILD.gn ++++ b/components/sync/BUILD.gn +@@ -413,6 +413,7 @@ jumbo_static_library("rest_of_sync") { + "syncable/write_transaction_info.cc", + "syncable/write_transaction_info.h", + ] ++ sources += brave_components_sync_sources + + configs += [ "//build/config:precompiled_headers" ] +