Removing the use of PrimaryAccountPolicyManager for PrimaryAccountManager

Chromium change:
https://chromium.googlesource.com/chromium/src/+/abfe622f7307559a7cf778e3914bd2318949921f

commit abfe622f7307559a7cf778e3914bd2318949921f
Author: Mihai Sardarescu <msarda@chromium.org>
Date:   Fri Apr 1 21:34:14 2022 +0000

    Reland "Remove primary account policy manager from component"

    This reverts commit ba16c5c25c496e90b1af06e7f907593a22360e5f.

    Reason for revert:
    This refactoring moves the code in a good directions. The test that
    was failing previously was incorrect as it is signing out a Unicorn
    account on Android (sign-out operation that is forbidden). The new CL
    ensures that crash does not occur on Android and a follow-up CL
    will address the crash.

    Original change's description:
    > Revert "Remove primary account policy manager from component"
    >
    > This reverts commit 61ea12dbf954b9e93cabf17247d267bcdd3c2df0.
    >
    > Reason for revert:
    > Introduced a crash on Android:
    > https://bugs.chromium.org/p/chromium/issues/detail?id=1285271#c7
    >
    > Original change's description:
    > > Remove primary account policy manager from component
    > >
    > > This CL moves the PrimaryAccountPolicyManager out of component/signin.
    > > It reuses the logic in //chrome when a profile needs to be deleted,
    > > showing a warning dialog that this will happen.
    > >
    > > Bug: 1284607
This commit is contained in:
Claudio DeSouza
2022-05-13 18:01:40 +01:00
parent 8bdc2b3f93
commit ee514506e0
@@ -24,7 +24,6 @@
#include "components/signin/internal/identity_manager/gaia_cookie_manager_service.h"
#include "components/signin/internal/identity_manager/primary_account_manager.h"
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/internal/identity_manager/primary_account_policy_manager_impl.h"
#include "components/signin/public/base/account_consistency_method.h"
#include "components/signin/public/base/list_accounts_test_utils.h"
#include "components/signin/public/base/signin_switches.h"
@@ -113,10 +112,8 @@ class BraveIdentityManagerTest : public testing::Test {
std::make_unique<image_fetcher::FakeImageDecoder>(),
std::make_unique<FakeAccountCapabilitiesFetcherFactory>());
std::unique_ptr<PrimaryAccountPolicyManager> policy_manager;
auto primary_account_manager = std::make_unique<PrimaryAccountManager>(
&signin_client_, token_service.get(), account_tracker_service.get(),
std::move(policy_manager));
&signin_client_, token_service.get(), account_tracker_service.get());
// Passing this switch ensures that the new PrimaryAccountManager starts
// with a clean slate. Otherwise PrimaryAccountManager::Initialize will use