Commit 66a47f78 authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Commit Bot

Changing IdentityManager::Observer and its subclasses to use CoreAccountId

This cl is part of the effort to use CoreAccountId instead of std::string
to denote account_id.

Bug: 959157
Change-Id: I0fd318d8034fb1294336f7534eb672fd1faeb084
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611996Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Tanmoy Mollik <triploblastic@google.com>
Cr-Commit-Position: refs/heads/master@{#661344}
parent 204103d6
......@@ -528,7 +528,8 @@ class DiceBrowserTest : public InProcessBrowserTest,
}
}
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override {
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override {
++token_revoked_notification_count_;
}
......
......@@ -80,9 +80,9 @@ void AccountTracker::OnRefreshTokenUpdatedForAccount(
}
void AccountTracker::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
TRACE_EVENT1("identity", "AccountTracker::OnRefreshTokenRemovedForAccount",
"account_id", account_id);
"account_id", account_id.id);
DVLOG(1) << "REVOKED " << account_id;
UpdateSignInState(account_id, /*is_signed_in=*/false);
......
......@@ -83,7 +83,8 @@ class AccountTracker : public identity::IdentityManager::Observer {
const CoreAccountInfo& previous_primary_account_info) override;
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
void OnUserInfoFetchSuccess(AccountIdFetcher* fetcher,
const std::string& gaia_id);
......
......@@ -116,7 +116,7 @@ void ProfileIdentityProvider::OnRefreshTokenUpdatedForAccount(
}
void ProfileIdentityProvider::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
ProcessRefreshTokenRemovalForAccount(account_id);
}
......
......@@ -34,7 +34,8 @@ class ProfileIdentityProvider : public IdentityProvider,
// identity::IdentityManager::Observer:
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
private:
identity::IdentityManager* const identity_manager_;
......
......@@ -342,7 +342,7 @@ void SyncAuthManager::OnRefreshTokenUpdatedForAccount(
}
void SyncAuthManager::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
// If we're syncing to a different account, then this doesn't affect us.
if (account_id != sync_account_.account_info.account_id) {
return;
......
......@@ -104,7 +104,8 @@ class SyncAuthManager : public identity::IdentityManager::Observer {
const CoreAccountInfo& previous_primary_account_info) override;
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
void OnAccountsInCookieUpdated(
const identity::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
const GoogleServiceAuthError& error) override;
......
......@@ -136,7 +136,7 @@ void SyncSessionDurationsMetricsRecorder::OnRefreshTokenUpdatedForAccount(
}
void SyncSessionDurationsMetricsRecorder::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
DVLOG(1) << __func__;
HandleSyncAndAccountChange();
}
......
......@@ -40,7 +40,8 @@ class SyncSessionDurationsMetricsRecorder
// IdentityManager::Observer:
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
void OnRefreshTokensLoaded() override;
void OnErrorStateOfRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info,
......
......@@ -40,7 +40,7 @@ void RecordAuthResultHistogram(int value) {
class AuthRequest {
public:
AuthRequest(identity::IdentityManager* identity_manager,
const std::string& account_id,
const CoreAccountId& account_id,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const AuthStatusCallback& callback,
const std::vector<std::string>& scopes);
......@@ -59,7 +59,7 @@ class AuthRequest {
AuthRequest::AuthRequest(
identity::IdentityManager* identity_manager,
const std::string& account_id,
const CoreAccountId& account_id,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const AuthStatusCallback& callback,
const std::vector<std::string>& scopes)
......@@ -112,7 +112,7 @@ void AuthRequest::OnAccessTokenFetchComplete(
AuthService::AuthService(
identity::IdentityManager* identity_manager,
const std::string& account_id,
const CoreAccountId& account_id,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const std::vector<std::string>& scopes)
: identity_manager_(identity_manager),
......@@ -207,7 +207,7 @@ void AuthService::OnRefreshTokenUpdatedForAccount(
}
void AuthService::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
if (account_id == account_id_)
OnHandleRefreshToken(false);
}
......
......@@ -36,7 +36,7 @@ class AuthService : public AuthServiceInterface,
//
// |scopes| specifies OAuth2 scopes.
AuthService(identity::IdentityManager* identity_manager,
const std::string& account_id,
const CoreAccountId& account_id,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const std::vector<std::string>& scopes);
~AuthService() override;
......@@ -54,7 +54,8 @@ class AuthService : public AuthServiceInterface,
// Overridden from IdentityManager::Observer
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
private:
// Called when the state of the refresh token changes.
......@@ -67,7 +68,7 @@ class AuthService : public AuthServiceInterface,
const std::string& access_token);
identity::IdentityManager* identity_manager_;
std::string account_id_;
CoreAccountId account_id_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
bool has_refresh_token_;
std::string access_token_;
......
......@@ -98,7 +98,7 @@ class IdentityManager : public SigninManagerBase::Observer,
// OnPrimaryAccountCleared() callback is undefined.If this lack of ordering
// is problematic for your use case, please contact blundell@chromium.org.
virtual void OnRefreshTokenRemovedForAccount(
const std::string& account_id) {}
const CoreAccountId& account_id) {}
// Called when the error state of the refresh token for |account_id| has
// changed. Note: It is always called after
......
......@@ -68,7 +68,8 @@ class ClearPrimaryAccountTestObserver
on_primary_account_cleared_.Run(account_info);
}
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override {
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override {
on_refresh_token_removed_.Run(account_id);
}
......
......@@ -70,7 +70,7 @@ void TestIdentityManagerObserver::SetOnRefreshTokenRemovedCallback(
on_refresh_token_removed_callback_ = std::move(callback);
}
const std::string&
const CoreAccountId&
TestIdentityManagerObserver::AccountIdFromRefreshTokenRemovedCallback() {
return account_from_refresh_token_removed_callback_;
}
......@@ -116,7 +116,7 @@ bool TestIdentityManagerObserver::WasCalledAccountRemovedWithInfoCallback() {
// Each element represents all the changes from an individual batch that has
// occurred, with the elements ordered from oldest to newest batch occurrence.
const std::vector<std::vector<std::string>>&
const std::vector<std::vector<CoreAccountId>>&
TestIdentityManagerObserver::BatchChangeRecords() const {
return batch_change_records_;
}
......@@ -148,7 +148,7 @@ void TestIdentityManagerObserver::OnRefreshTokenUpdatedForAccount(
}
void TestIdentityManagerObserver::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
if (!is_inside_batch_)
StartBatchOfRefreshTokenStateChanges();
......@@ -201,7 +201,7 @@ void TestIdentityManagerObserver::StartBatchOfRefreshTokenStateChanges() {
is_inside_batch_ = true;
// Start a new batch.
batch_change_records_.emplace_back(std::vector<std::string>());
batch_change_records_.emplace_back(std::vector<CoreAccountId>());
}
void TestIdentityManagerObserver::OnEndBatchOfRefreshTokenStateChanges() {
......
......@@ -39,7 +39,7 @@ class TestIdentityManagerObserver : IdentityManager::Observer {
ErrorFromErrorStateOfRefreshTokenUpdatedCallback() const;
void SetOnRefreshTokenRemovedCallback(base::OnceClosure callback);
const std::string& AccountIdFromRefreshTokenRemovedCallback();
const CoreAccountId& AccountIdFromRefreshTokenRemovedCallback();
void SetOnRefreshTokensLoadedCallback(base::OnceClosure callback);
......@@ -57,7 +57,7 @@ class TestIdentityManagerObserver : IdentityManager::Observer {
// Each element represents all the changes from an individual batch that has
// occurred, with the elements ordered from oldest to newest batch occurrence.
const std::vector<std::vector<std::string>>& BatchChangeRecords() const;
const std::vector<std::vector<CoreAccountId>>& BatchChangeRecords() const;
private:
// IdentityManager::Observer:
......@@ -67,7 +67,8 @@ class TestIdentityManagerObserver : IdentityManager::Observer {
const CoreAccountInfo& previous_primary_account_info) override;
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
void OnErrorStateOfRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info,
const GoogleServiceAuthError& error) override;
......@@ -101,7 +102,7 @@ class TestIdentityManagerObserver : IdentityManager::Observer {
error_from_error_state_of_refresh_token_updated_callback_;
base::OnceClosure on_refresh_token_removed_callback_;
std::string account_from_refresh_token_removed_callback_;
CoreAccountId account_from_refresh_token_removed_callback_;
base::OnceClosure on_refresh_tokens_loaded_callback_;
......@@ -116,7 +117,7 @@ class TestIdentityManagerObserver : IdentityManager::Observer {
bool is_inside_batch_ = false;
bool was_called_account_removed_with_info_callback_ = false;
std::vector<std::vector<std::string>> batch_change_records_;
std::vector<std::vector<CoreAccountId>> batch_change_records_;
DISALLOW_COPY_AND_ASSIGN(TestIdentityManagerObserver);
};
......
......@@ -53,7 +53,8 @@ class IdentityManagerObserverBridge : public IdentityManager::Observer {
const CoreAccountInfo& previous_primary_account_info) override;
void OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) override;
void OnRefreshTokenRemovedForAccount(const std::string& account_id) override;
void OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) override;
void OnRefreshTokensLoaded() override;
void OnAccountsInCookieUpdated(
const identity::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
......
......@@ -44,10 +44,10 @@ void IdentityManagerObserverBridge::OnRefreshTokenUpdatedForAccount(
}
void IdentityManagerObserverBridge::OnRefreshTokenRemovedForAccount(
const std::string& account_id) {
const CoreAccountId& account_id) {
if ([delegate_
respondsToSelector:@selector(onRefreshTokenRemovedForAccount:)]) {
[delegate_ onRefreshTokenRemovedForAccount:account_id];
[delegate_ onRefreshTokenRemovedForAccount:account_id.id];
}
}
......
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