Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure only one IdentityManagerFactory instance gets created #8731

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 0 additions & 84 deletions browser/signin/brave_identity_manager_factory.cc

This file was deleted.

42 changes: 0 additions & 42 deletions browser/signin/brave_identity_manager_factory.h

This file was deleted.

13 changes: 0 additions & 13 deletions browser/signin/sources.gni

This file was deleted.

3 changes: 0 additions & 3 deletions browser/sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -320,7 +319,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
Expand All @@ -340,7 +338,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
Expand Down
20 changes: 0 additions & 20 deletions chromium_src/chrome/browser/signin/identity_manager_factory.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<syncer::BraveProfileSyncService>( \
std::move(init_params), \
Expand All @@ -20,5 +16,3 @@
#include "../../../../../chrome/browser/sync/profile_sync_service_factory.cc"

#undef BRAVE_BUILD_SERVICE_INSTANCE_FOR

#undef IdentityManagerFactory
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
/* 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/components/signin/public/identity_manager/brave_identity_manager.h"
#include "components/signin/public/identity_manager/identity_manager.h"

#include <utility>
#include <vector>

#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"
#define GetAccountsInCookieJar GetAccountsInCookieJar_Unused
#include "../../../../../../components/signin/public/identity_manager/identity_manager.cc"
#undef GetAccountsInCookieJar

namespace signin {

BraveIdentityManager::BraveIdentityManager(
IdentityManager::InitParameters&& parameters)
: IdentityManager(std::move(parameters)) {}

BraveIdentityManager::~BraveIdentityManager() {}

AccountsInCookieJarInfo BraveIdentityManager::GetAccountsInCookieJar() const {
AccountsInCookieJarInfo IdentityManager::GetAccountsInCookieJar() const {
// accounts_in_cookie_jar_info.accounts_are_fresh must be false,
// see `ProfileSyncService::OnEngineInitialized`
return AccountsInCookieJarInfo(false, std::vector<gaia::ListedAccount>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BravePrimaryAccountMutatorImpl>(
Expand All @@ -29,10 +34,10 @@ IdentityManager::InitParameters BuildBraveIdentityManagerInitParameters(

} // namespace

std::unique_ptr<BraveIdentityManager> BuildBraveIdentityManager(
std::unique_ptr<IdentityManager> BuildIdentityManager(
IdentityManagerBuildParams* params) {
return std::make_unique<BraveIdentityManager>(
BuildBraveIdentityManagerInitParameters(params));
return std::make_unique<IdentityManager>(
BuildIdentityManagerInitParameters(params));
}

} // namespace signin

This file was deleted.

41 changes: 0 additions & 41 deletions components/signin/public/identity_manager/brave_identity_manager.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 <utility>
#include <vector>

Expand Down Expand Up @@ -160,7 +158,7 @@ class BraveIdentityManagerTest : public testing::Test {
init_params.token_service = std::move(token_service);

identity_manager_ =
std::make_unique<BraveIdentityManager>(std::move(init_params));
std::make_unique<IdentityManager>(std::move(init_params));
identity_manager_observer_ =
std::make_unique<TestIdentityManagerObserver>(identity_manager_.get());
}
Expand Down
9 changes: 0 additions & 9 deletions components/signin/public/identity_manager/sources.gni

This file was deleted.

Loading