From a9becf3523372ee2cb43b65d6ae8f998ae4f21ac Mon Sep 17 00:00:00 2001 From: Mario Sanchez Prada Date: Wed, 5 May 2021 20:29:36 +0200 Subject: [PATCH] Ensure only one IdentityManagerFactory instance gets created IdentityManagerFactory is a class meant to be instantiated in the browser process via base::Singleton, thus it's not expected to have several instance of them. However, since PR #7480[1] we're actually creating two instances for Brave: the BraveIdentityManagerFactory (subclass) instanced from ProfileSyncServiceFactory as part of a DependsOn() statement, and another one for every other place in the code (68 callpoints at this time) using DependsOn(IdentityManagerFactory::GetInstance()) to initialize different services. This hasn't rang any alarm until Chromium 92.0.4496.3, but in that release some changes were made[2] including the introduction of the IdentityManagerProvider class, which now DCHECKs for having only one instance of IdentityManagerFactory created in the browser: void SetIdentityManagerProvider(const IdentityManagerProvider& provider) { IdentityManagerProvider& instance = GetIdentityManagerProvider(); DCHECK(!instance); instance = provider; } ...meaning that we will get a crash on startup and all the unit and browser tests crashing on DCHECK-enabled builds, revealing this issue that we didn't know we had until now. This patch, makes changes to ensure we have one IdentityManagerFactory instance only, by removing a few parts of the infrastructure added with PR #7480[1] and simply leveraging chromium_src overrides to implement the changes we need for the IdentityManager: to empty implementations of GetAccountsInCookieJar() and GetPrimaryAccountMutator(). [1] https://github.com/brave/brave-core/pull/7480 [2] https://chromium-review.googlesource.com/c/chromium/src/+/2824129 Resolves https://github.com/brave/brave-browser/issues/15659 --- .../signin/brave_identity_manager_factory.cc | 84 ------------------- .../signin/brave_identity_manager_factory.h | 42 ---------- browser/signin/sources.gni | 13 --- browser/sources.gni | 3 - .../browser/signin/identity_manager_factory.h | 20 ----- .../sync/profile_sync_service_factory.cc | 6 -- .../identity_manager/identity_manager.cc | 24 ++++++ .../identity_manager/identity_manager.h | 4 +- .../identity_manager_builder.cc | 17 ++-- .../identity_manager_builder.h | 27 ------ .../brave_identity_manager.cc | 30 ------- .../identity_manager/brave_identity_manager.h | 41 --------- .../brave_identity_manager_unittest.cc | 4 +- .../public/identity_manager/sources.gni | 9 -- ...er-signin-identity_manager_factory.h.patch | 12 --- ...n-internal-identity_manager-BUILD.gn.patch | 14 +--- ...nin-public-identity_manager-BUILD.gn.patch | 20 ----- 17 files changed, 42 insertions(+), 328 deletions(-) delete mode 100644 browser/signin/brave_identity_manager_factory.cc delete mode 100644 browser/signin/brave_identity_manager_factory.h delete mode 100644 browser/signin/sources.gni delete mode 100644 chromium_src/chrome/browser/signin/identity_manager_factory.h create mode 100644 chromium_src/components/signin/public/identity_manager/identity_manager.cc delete mode 100644 chromium_src/components/signin/public/identity_manager/identity_manager_builder.h delete mode 100644 components/signin/public/identity_manager/brave_identity_manager.cc delete mode 100644 components/signin/public/identity_manager/brave_identity_manager.h delete mode 100644 components/signin/public/identity_manager/sources.gni delete mode 100644 patches/chrome-browser-signin-identity_manager_factory.h.patch delete mode 100644 patches/components-signin-public-identity_manager-BUILD.gn.patch diff --git a/browser/signin/brave_identity_manager_factory.cc b/browser/signin/brave_identity_manager_factory.cc deleted file mode 100644 index 3dc73dce92d8..000000000000 --- a/browser/signin/brave_identity_manager_factory.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* 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/browser/signin/brave_identity_manager_factory.h" - -#include - -#include "base/files/file_path.h" -#include "brave/components/signin/public/identity_manager/brave_identity_manager.h" -#include "build/build_config.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/image_fetcher/image_decoder_impl.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/account_consistency_mode_manager.h" -#include "chrome/browser/signin/chrome_signin_client_factory.h" -#include "components/signin/public/identity_manager/identity_manager_builder.h" -#include "components/signin/public/webdata/token_web_data.h" -#include "content/public/browser/network_service_instance.h" - -#if !defined(OS_ANDROID) -#include "chrome/browser/content_settings/cookie_settings_factory.h" -#include "chrome/browser/web_data_service_factory.h" -#include "components/content_settings/core/browser/cookie_settings.h" -#include "components/keyed_service/core/service_access_type.h" -#include "components/signin/core/browser/cookie_settings_util.h" -#endif - -BraveIdentityManagerFactory::BraveIdentityManagerFactory() - : IdentityManagerFactory() {} - -BraveIdentityManagerFactory::~BraveIdentityManagerFactory() {} - -// static -signin::BraveIdentityManager* BraveIdentityManagerFactory::GetForProfile( - Profile* profile) { - return static_cast( - GetInstance()->GetServiceForBrowserContext(profile, true)); -} - -// static -signin::BraveIdentityManager* -BraveIdentityManagerFactory::GetForProfileIfExists(const Profile* profile) { - return static_cast( - GetInstance()->GetServiceForBrowserContext(const_cast(profile), - false)); -} - -// static -BraveIdentityManagerFactory* BraveIdentityManagerFactory::GetInstance() { - return base::Singleton::get(); -} - -KeyedService* BraveIdentityManagerFactory::BuildServiceInstanceFor( - content::BrowserContext* context) const { - Profile* profile = Profile::FromBrowserContext(context); - - signin::IdentityManagerBuildParams params; - params.account_consistency = - AccountConsistencyModeManager::GetMethodForProfile(profile), - params.image_decoder = std::make_unique(); - params.local_state = g_browser_process->local_state(); - params.network_connection_tracker = content::GetNetworkConnectionTracker(); - params.pref_service = profile->GetPrefs(); - params.profile_path = profile->GetPath(); - params.signin_client = ChromeSigninClientFactory::GetForProfile(profile); - -#if !defined(OS_ANDROID) - params.delete_signin_cookies_on_exit = - signin::SettingsDeleteSigninCookiesOnExit( - CookieSettingsFactory::GetForProfile(profile).get()); - params.token_web_data = WebDataServiceFactory::GetTokenWebDataForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); -#endif - - std::unique_ptr brave_identity_manager = - signin::BuildBraveIdentityManager(¶ms); - - return brave_identity_manager.release(); -} - -void BraveIdentityManagerFactory::RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) {} diff --git a/browser/signin/brave_identity_manager_factory.h b/browser/signin/brave_identity_manager_factory.h deleted file mode 100644 index db69573f018c..000000000000 --- a/browser/signin/brave_identity_manager_factory.h +++ /dev/null @@ -1,42 +0,0 @@ -/* 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_BROWSER_SIGNIN_BRAVE_IDENTITY_MANAGER_FACTORY_H_ -#define BRAVE_BROWSER_SIGNIN_BRAVE_IDENTITY_MANAGER_FACTORY_H_ - -#include "base/memory/singleton.h" -#include "chrome/browser/signin/identity_manager_factory.h" - -namespace signin { -class BraveIdentityManager; -} - -class Profile; - -class BraveIdentityManagerFactory : public IdentityManagerFactory { - public: - BraveIdentityManagerFactory(const BraveIdentityManagerFactory&) = delete; - BraveIdentityManagerFactory& operator=(const BraveIdentityManagerFactory&) = - delete; - - // Returns an instance of the IdentityManagerFactory singleton. - static BraveIdentityManagerFactory* GetInstance(); - - static signin::BraveIdentityManager* GetForProfile(Profile* profile); - static signin::BraveIdentityManager* GetForProfileIfExists( - const Profile* profile); - - private: - friend struct base::DefaultSingletonTraits; - BraveIdentityManagerFactory(); - ~BraveIdentityManagerFactory() override; - - KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const override; - void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) override; -}; - -#endif // BRAVE_BROWSER_SIGNIN_BRAVE_IDENTITY_MANAGER_FACTORY_H_ diff --git a/browser/signin/sources.gni b/browser/signin/sources.gni deleted file mode 100644 index a1bb07964b4c..000000000000 --- a/browser/signin/sources.gni +++ /dev/null @@ -1,13 +0,0 @@ -# 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/. - -import("//brave/components/brave_wallet/common/buildflags/buildflags.gni") - -brave_browser_signin_sources = [ - "//brave/browser/signin/brave_identity_manager_factory.cc", - "//brave/browser/signin/brave_identity_manager_factory.h", -] - -brave_browser_signin_deps = [ "//base" ] diff --git a/browser/sources.gni b/browser/sources.gni index 97506ae1984e..f6ee5a926c9a 100644 --- a/browser/sources.gni +++ b/browser/sources.gni @@ -19,7 +19,6 @@ import("//brave/browser/ipfs/sources.gni") import("//brave/browser/new_tab/sources.gni") import("//brave/browser/permissions/sources.gni") import("//brave/browser/search_engines/sources.gni") -import("//brave/browser/signin/sources.gni") import("//brave/browser/speedreader/sources.gni") import("//brave/browser/themes/sources.gni") import("//brave/chromium_src/chrome/browser/prefs/sources.gni") @@ -319,7 +318,6 @@ brave_chrome_browser_sources += brave_browser_ipfs_sources brave_chrome_browser_sources += brave_browser_new_tab_sources brave_chrome_browser_sources += brave_browser_permissions_sources brave_chrome_browser_sources += brave_browser_search_engines_sources -brave_chrome_browser_sources += brave_browser_signin_sources brave_chrome_browser_sources += brave_browser_speedreader_sources brave_chrome_browser_sources += brave_browser_themes_sources brave_chrome_browser_sources += brave_browser_wallet_sources @@ -339,7 +337,6 @@ brave_chrome_browser_deps += brave_browser_ipfs_deps brave_chrome_browser_deps += brave_browser_new_tab_deps brave_chrome_browser_deps += brave_browser_permissions_deps brave_chrome_browser_deps += brave_browser_search_engines_deps -brave_chrome_browser_deps += brave_browser_signin_deps brave_chrome_browser_deps += brave_browser_speedreader_deps brave_chrome_browser_deps += brave_browser_themes_deps brave_chrome_browser_deps += brave_browser_wallet_deps diff --git a/chromium_src/chrome/browser/signin/identity_manager_factory.h b/chromium_src/chrome/browser/signin/identity_manager_factory.h deleted file mode 100644 index 2ea179eabbd9..000000000000 --- a/chromium_src/chrome/browser/signin/identity_manager_factory.h +++ /dev/null @@ -1,20 +0,0 @@ -/* 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_CHROMIUM_SRC_CHROME_BROWSER_SIGNIN_IDENTITY_MANAGER_FACTORY_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SIGNIN_IDENTITY_MANAGER_FACTORY_H_ - -class BraveIdentityManagerFactory; - -#define BRAVE_IDENTITY_MANAGER_FACTORY_H_ \ - private: \ - friend class BraveIdentityManagerFactory; \ - friend struct base::DefaultSingletonTraits; - -#include "../../../../../chrome/browser/signin/identity_manager_factory.h" - -#undef BRAVE_IDENTITY_MANAGER_FACTORY_H_ - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SIGNIN_IDENTITY_MANAGER_FACTORY_H_ diff --git a/chromium_src/chrome/browser/sync/profile_sync_service_factory.cc b/chromium_src/chrome/browser/sync/profile_sync_service_factory.cc index fb543409c329..827a6f1f621b 100644 --- a/chromium_src/chrome/browser/sync/profile_sync_service_factory.cc +++ b/chromium_src/chrome/browser/sync/profile_sync_service_factory.cc @@ -3,14 +3,10 @@ * 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/browser/signin/brave_identity_manager_factory.h" #include "brave/browser/sync/brave_profile_sync_service_delegate.h" -#include "brave/components/signin/public/identity_manager/brave_identity_manager.h" #include "brave/components/sync/driver/brave_sync_profile_sync_service.h" #include "chrome/browser/sync/device_info_sync_service_factory.h" -#define IdentityManagerFactory BraveIdentityManagerFactory - #define BRAVE_BUILD_SERVICE_INSTANCE_FOR \ std::make_unique( \ std::move(init_params), \ @@ -20,5 +16,3 @@ #include "../../../../../chrome/browser/sync/profile_sync_service_factory.cc" #undef BRAVE_BUILD_SERVICE_INSTANCE_FOR - -#undef IdentityManagerFactory diff --git a/chromium_src/components/signin/public/identity_manager/identity_manager.cc b/chromium_src/components/signin/public/identity_manager/identity_manager.cc new file mode 100644 index 000000000000..e754315d685e --- /dev/null +++ b/chromium_src/components/signin/public/identity_manager/identity_manager.cc @@ -0,0 +1,24 @@ +/* Copyright (c) 2021 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/chromium_src/components/signin/public/identity_manager/identity_manager.h" + +#include +#include + +#define GetAccountsInCookieJar GetAccountsInCookieJar_Unused +#include "../../../../../../components/signin/public/identity_manager/identity_manager.cc" +#undef GetAccountsInCookieJar + +namespace signin { + +AccountsInCookieJarInfo IdentityManager::GetAccountsInCookieJar() const { + // accounts_in_cookie_jar_info.accounts_are_fresh must be false, + // see `ProfileSyncService::OnEngineInitialized` + return AccountsInCookieJarInfo(false, std::vector(), + std::vector()); +} + +} // namespace signin diff --git a/chromium_src/components/signin/public/identity_manager/identity_manager.h b/chromium_src/components/signin/public/identity_manager/identity_manager.h index a95dff8e4f30..3d704c2c5a8e 100644 --- a/chromium_src/components/signin/public/identity_manager/identity_manager.h +++ b/chromium_src/components/signin/public/identity_manager/identity_manager.h @@ -6,7 +6,9 @@ #ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IDENTITY_MANAGER_H_ #define BRAVE_CHROMIUM_SRC_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IDENTITY_MANAGER_H_ -#define GetAccountsInCookieJar virtual GetAccountsInCookieJar +#define GetAccountsInCookieJar \ + GetAccountsInCookieJar_Unused() const; \ + AccountsInCookieJarInfo GetAccountsInCookieJar #include "../../../../../../components/signin/public/identity_manager/identity_manager.h" diff --git a/chromium_src/components/signin/public/identity_manager/identity_manager_builder.cc b/chromium_src/components/signin/public/identity_manager/identity_manager_builder.cc index 26b2447c8325..37f7c0cbfbdd 100644 --- a/chromium_src/components/signin/public/identity_manager/identity_manager_builder.cc +++ b/chromium_src/components/signin/public/identity_manager/identity_manager_builder.cc @@ -3,19 +3,24 @@ * 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/. */ +#define BuildIdentityManager BuildIdentityManager_Unused +#define BuildIdentityManagerInitParameters \ + BuildIdentityManagerInitParameters_ChromiumImpl #include "../../../../../../components/signin/public/identity_manager/identity_manager_builder.cc" +#undef BuildIdentityManagerInitParameters +#undef BuildIdentityManager #include "brave/components/signin/internal/identity_manager/brave_primary_account_mutator_impl.h" -#include "brave/components/signin/public/identity_manager/brave_identity_manager.h" +#include "components/signin/public/identity_manager/identity_manager.h" namespace signin { namespace { -IdentityManager::InitParameters BuildBraveIdentityManagerInitParameters( +IdentityManager::InitParameters BuildIdentityManagerInitParameters( IdentityManagerBuildParams* params) { IdentityManager::InitParameters init_params = - BuildIdentityManagerInitParameters(params); + BuildIdentityManagerInitParameters_ChromiumImpl(params); init_params.primary_account_mutator = std::make_unique( @@ -29,10 +34,10 @@ IdentityManager::InitParameters BuildBraveIdentityManagerInitParameters( } // namespace -std::unique_ptr BuildBraveIdentityManager( +std::unique_ptr BuildIdentityManager( IdentityManagerBuildParams* params) { - return std::make_unique( - BuildBraveIdentityManagerInitParameters(params)); + return std::make_unique( + BuildIdentityManagerInitParameters(params)); } } // namespace signin diff --git a/chromium_src/components/signin/public/identity_manager/identity_manager_builder.h b/chromium_src/components/signin/public/identity_manager/identity_manager_builder.h deleted file mode 100644 index 1ac1ad549463..000000000000 --- a/chromium_src/components/signin/public/identity_manager/identity_manager_builder.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IDENTITY_MANAGER_BUILDER_H_ -#define BRAVE_CHROMIUM_SRC_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IDENTITY_MANAGER_BUILDER_H_ - -#include - -#include "components/signin/public/identity_manager/identity_manager.h" - -namespace signin { - -class BraveIdentityManager; -struct IdentityManagerBuildParams; - -// Builds an IdentityManager instance from the supplied embedder-level -// dependencies. -std::unique_ptr BuildBraveIdentityManager( - IdentityManagerBuildParams* params); - -} // namespace signin - -#include "../../../../../../components/signin/public/identity_manager/identity_manager_builder.h" - -#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IDENTITY_MANAGER_BUILDER_H_ diff --git a/components/signin/public/identity_manager/brave_identity_manager.cc b/components/signin/public/identity_manager/brave_identity_manager.cc deleted file mode 100644 index cbf3abb1e447..000000000000 --- a/components/signin/public/identity_manager/brave_identity_manager.cc +++ /dev/null @@ -1,30 +0,0 @@ -/* 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/signin/public/identity_manager/brave_identity_manager.h" - -#include -#include - -#include "components/signin/public/base/signin_client.h" -#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h" -#include "components/signin/public/identity_manager/identity_manager.h" - -namespace signin { - -BraveIdentityManager::BraveIdentityManager( - IdentityManager::InitParameters&& parameters) - : IdentityManager(std::move(parameters)) {} - -BraveIdentityManager::~BraveIdentityManager() {} - -AccountsInCookieJarInfo BraveIdentityManager::GetAccountsInCookieJar() const { - // accounts_in_cookie_jar_info.accounts_are_fresh must be false, - // see `ProfileSyncService::OnEngineInitialized` - return AccountsInCookieJarInfo(false, std::vector(), - std::vector()); -} - -} // namespace signin diff --git a/components/signin/public/identity_manager/brave_identity_manager.h b/components/signin/public/identity_manager/brave_identity_manager.h deleted file mode 100644 index b73f60b03dba..000000000000 --- a/components/signin/public/identity_manager/brave_identity_manager.h +++ /dev/null @@ -1,41 +0,0 @@ -/* 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_SIGNIN_PUBLIC_IDENTITY_MANAGER_BRAVE_IDENTITY_MANAGER_H_ -#define BRAVE_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_BRAVE_IDENTITY_MANAGER_H_ - -#include - -#include "components/signin/public/identity_manager/identity_manager.h" - -// Purpose of this class is to redirect to empty implementation -// syncer::ProfileSyncService::identity_manager_ -// These must be overridden and empty: -// GetAccountsInCookieJar -// GetPrimaryAccountMutator - done in `BuildBraveIdentityManagerInitParameters` - -class GoogleServiceAuthError; -class BraveAccountFetcherService; - -namespace signin { - -struct AccountsInCookieJarInfo; -class PrimaryAccountMutator; -class BravePrimaryAccountMutator; - -class BraveIdentityManager : public IdentityManager { - public: - explicit BraveIdentityManager(IdentityManager::InitParameters&& parameters); - ~BraveIdentityManager() override; - - BraveIdentityManager(const BraveIdentityManager&) = delete; - BraveIdentityManager& operator=(const BraveIdentityManager&) = delete; - - AccountsInCookieJarInfo GetAccountsInCookieJar() const override; -}; - -} // namespace signin - -#endif // BRAVE_COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_BRAVE_IDENTITY_MANAGER_H_ diff --git a/components/signin/public/identity_manager/brave_identity_manager_unittest.cc b/components/signin/public/identity_manager/brave_identity_manager_unittest.cc index 7d9c2b3775f2..45c3952cfab3 100644 --- a/components/signin/public/identity_manager/brave_identity_manager_unittest.cc +++ b/components/signin/public/identity_manager/brave_identity_manager_unittest.cc @@ -3,8 +3,6 @@ * 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/signin/public/identity_manager/brave_identity_manager.h" - #include #include @@ -160,7 +158,7 @@ class BraveIdentityManagerTest : public testing::Test { init_params.token_service = std::move(token_service); identity_manager_ = - std::make_unique(std::move(init_params)); + std::make_unique(std::move(init_params)); identity_manager_observer_ = std::make_unique(identity_manager_.get()); } diff --git a/components/signin/public/identity_manager/sources.gni b/components/signin/public/identity_manager/sources.gni deleted file mode 100644 index 08170231506b..000000000000 --- a/components/signin/public/identity_manager/sources.gni +++ /dev/null @@ -1,9 +0,0 @@ -# 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_signin_public_identity_manager_sources = [ - "//brave/components/signin/public/identity_manager/brave_identity_manager.cc", - "//brave/components/signin/public/identity_manager/brave_identity_manager.h", -] diff --git a/patches/chrome-browser-signin-identity_manager_factory.h.patch b/patches/chrome-browser-signin-identity_manager_factory.h.patch deleted file mode 100644 index e46b0e4e2aac..000000000000 --- a/patches/chrome-browser-signin-identity_manager_factory.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/chrome/browser/signin/identity_manager_factory.h b/chrome/browser/signin/identity_manager_factory.h -index a5788b94bd1ecc73c7776ee8584343772aeca0bd..d62c498e090a860d1981d2ed1f277802feae50e1 100644 ---- a/chrome/browser/signin/identity_manager_factory.h -+++ b/chrome/browser/signin/identity_manager_factory.h -@@ -47,6 +47,7 @@ class IdentityManagerFactory : public BrowserContextKeyedServiceFactory { - void AddObserver(Observer* observer); - void RemoveObserver(Observer* observer); - -+ BRAVE_IDENTITY_MANAGER_FACTORY_H_ - private: - friend struct base::DefaultSingletonTraits; - diff --git a/patches/components-signin-internal-identity_manager-BUILD.gn.patch b/patches/components-signin-internal-identity_manager-BUILD.gn.patch index 1b5dc5dde5c1..eff92b6197d0 100644 --- a/patches/components-signin-internal-identity_manager-BUILD.gn.patch +++ b/patches/components-signin-internal-identity_manager-BUILD.gn.patch @@ -1,20 +1,12 @@ diff --git a/components/signin/internal/identity_manager/BUILD.gn b/components/signin/internal/identity_manager/BUILD.gn -index 8f54d7a1cc96c6db7022c8b7cad38ff22b706547..15fc1dcd64316d506314a0a54c1c1ba62c509d18 100644 +index 8f54d7a1cc96c6db7022c8b7cad38ff22b706547..a8cc5ec84da7d44d082b13879970ba8717283967 100644 --- a/components/signin/internal/identity_manager/BUILD.gn +++ b/components/signin/internal/identity_manager/BUILD.gn -@@ -4,6 +4,7 @@ - - import("//build/config/chromeos/ui_mode.gni") - import("//components/signin/features.gni") -+import("//brave/components/signin/internal/identity_manager/sources.gni") - - # This target forms the core of the IdentityManager implementation - # (//components/signin/public/identity_manager/identity_manager.*). -@@ -127,6 +128,7 @@ source_set("identity_manager") { +@@ -127,6 +127,7 @@ source_set("identity_manager") { "device_accounts_synchronizer_impl.h", ] } -+ sources += brave_components_signin_internal_identity_manager_sources ++ import("//brave/components/signin/internal/identity_manager/sources.gni") sources += brave_components_signin_internal_identity_manager_sources } source_set("unit_tests") { diff --git a/patches/components-signin-public-identity_manager-BUILD.gn.patch b/patches/components-signin-public-identity_manager-BUILD.gn.patch deleted file mode 100644 index acee8375205a..000000000000 --- a/patches/components-signin-public-identity_manager-BUILD.gn.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/components/signin/public/identity_manager/BUILD.gn b/components/signin/public/identity_manager/BUILD.gn -index dbe5921029b933cc0726793221a4aa676689bfbf..1cf95581ca971fa8bf5de6318e9a0c224c25d159 100644 ---- a/components/signin/public/identity_manager/BUILD.gn -+++ b/components/signin/public/identity_manager/BUILD.gn -@@ -7,6 +7,7 @@ import("//build/config/chromeos/ui_mode.gni") - if (is_android) { - import("//build/config/android/rules.gni") - } -+import("//brave/components/signin/public/identity_manager/sources.gni") - - source_set("identity_manager") { - sources = [ -@@ -82,6 +83,7 @@ source_set("identity_manager") { - # together and include headers from each other. - "//components/signin/internal/identity_manager", - ] -+ sources += brave_components_signin_public_identity_manager_sources - } - - if (is_android) {