Commit 71359b31 authored by Martin Šrámek's avatar Martin Šrámek Committed by Commit Bot

Revert "[s13n] Migrate ContentAreaAccountsMigration away from GCMS::Observer"

This reverts commit 5f7f5569.

Reason for revert: Seems to break multiple Chrome OS trybots. See crbug.com/926154 for more details.

Original change's description:
> [s13n] Migrate ContentAreaAccountsMigration away from GCMS::Observer
> 
> CL changes the inheritance ofi ContentAreaAccountsMigration from
> GaiaCookieManagerService::Observer to IdentityManager::Observer instead.
> 
> No functionality change expected.
> 
> BUG=859882
> 
> Change-Id: I907b2624d23e93b6a0ecbcda3e39f0322f238612
> Reviewed-on: https://chromium-review.googlesource.com/c/1436916
> Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Reviewed-by: Lowell Manners <lowell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#626748}

TBR=xiyuan@chromium.org,tonikitoo@igalia.com,lowell@chromium.org

Change-Id: Ide04520a6a6f249e5220a6b9086c80b591bc923e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 859882,926154
Reviewed-on: https://chromium-review.googlesource.com/c/1442197Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Commit-Queue: Martin Šrámek <msramek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626972}
parent 88e14121
......@@ -28,6 +28,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/web_data_service_factory.h"
#include "chrome/common/pref_names.h"
......@@ -39,9 +40,9 @@
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/gaia_cookie_manager_service.h"
#include "components/signin/core/browser/webdata/token_web_data.h"
#include "components/webdata/common/web_data_service_consumer.h"
#include "services/identity/public/cpp/accounts_in_cookie_jar_info.h"
#include "services/identity/public/cpp/identity_manager.h"
namespace chromeos {
......@@ -272,34 +273,39 @@ class DeviceAccountMigration : public AccountMigrationBaseStep,
// to |AccountManager|. The objective is to migrate the account names only. We
// cannot migrate any credentials (cookies).
class ContentAreaAccountsMigration : public AccountMigrationBaseStep,
identity::IdentityManager::Observer {
GaiaCookieManagerService::Observer {
public:
ContentAreaAccountsMigration(AccountManager* account_manager,
identity::IdentityManager* identity_manager)
ContentAreaAccountsMigration(
AccountManager* account_manager,
identity::IdentityManager* identity_manager,
GaiaCookieManagerService* gaia_cookie_manager_service)
: AccountMigrationBaseStep(kContentAreaAccountsMigration,
account_manager,
identity_manager),
identity_manager_(identity_manager) {}
gaia_cookie_manager_service_(gaia_cookie_manager_service) {}
~ContentAreaAccountsMigration() override {
identity_manager_->RemoveObserver(this);
gaia_cookie_manager_service_->RemoveObserver(this);
}
private:
void StartMigration() override {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
identity_manager_->AddObserver(this);
identity::AccountsInCookieJarInfo accounts_in_cookie_jar_info =
identity_manager_->GetAccountsInCookieJar();
if (accounts_in_cookie_jar_info.accounts_are_fresh) {
OnAccountsInCookieUpdated(
accounts_in_cookie_jar_info,
std::vector<gaia::ListedAccount> signed_in_content_area_accounts;
std::vector<gaia::ListedAccount> signed_out_content_area_accounts;
gaia_cookie_manager_service_->AddObserver(this);
if (gaia_cookie_manager_service_->ListAccounts(
&signed_in_content_area_accounts,
&signed_out_content_area_accounts)) {
OnGaiaAccountsInCookieUpdated(
signed_in_content_area_accounts, signed_out_content_area_accounts,
GoogleServiceAuthError(GoogleServiceAuthError::NONE));
}
}
void OnAccountsInCookieUpdated(
const identity::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
void OnGaiaAccountsInCookieUpdated(
const std::vector<gaia::ListedAccount>& signed_in_content_area_accounts,
const std::vector<gaia::ListedAccount>& signed_out_content_area_accounts,
const GoogleServiceAuthError& error) override {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// We should not have reached here without |OnGetAccounts| having been
......@@ -307,10 +313,10 @@ class ContentAreaAccountsMigration : public AccountMigrationBaseStep,
// Furthermore, Account Manager must have been populated with the Device
// Account before this |Step| is run.
DCHECK(!IsAccountManagerEmpty());
identity_manager_->RemoveObserver(this);
gaia_cookie_manager_service_->RemoveObserver(this);
MigrateAccounts(accounts_in_cookie_jar_info.signed_in_accounts,
accounts_in_cookie_jar_info.signed_out_accounts);
MigrateAccounts(signed_in_content_area_accounts,
signed_out_content_area_accounts);
FinishWithSuccess();
}
......@@ -328,8 +334,8 @@ class ContentAreaAccountsMigration : public AccountMigrationBaseStep,
}
}
// A non-owning pointer to |IdentityManager|.
identity::IdentityManager* const identity_manager_;
// A non-owning pointer to |GaiaCookieManagerService|.
GaiaCookieManagerService* const gaia_cookie_manager_service_;
SEQUENCE_CHECKER(sequence_checker_);
......@@ -518,7 +524,9 @@ void AccountManagerMigrator::AddMigrationSteps() {
WebDataServiceFactory::GetTokenWebDataForProfile(
profile_, ServiceAccessType::EXPLICIT_ACCESS) /* token_web_data */));
migration_runner_.AddStep(std::make_unique<ContentAreaAccountsMigration>(
account_manager, identity_manager));
account_manager, identity_manager,
GaiaCookieManagerServiceFactory::GetForProfile(
profile_) /* gaia_cookie_manager_service */));
if (arc::IsArcProvisioned(profile_)) {
// Add a migration step for ARC only if ARC has been provisioned. If ARC has
......@@ -602,7 +610,7 @@ AccountManagerMigratorFactory::AccountManagerMigratorFactory()
// be re-enabled once migration is done.
DependsOn(AccountReconcilorFactory::GetInstance());
// For getting Chrome content area accounts.
DependsOn(IdentityManagerFactory::GetInstance());
DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
}
AccountManagerMigratorFactory::~AccountManagerMigratorFactory() = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment