Commit 7817b3c5 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Remove const in some methods of ChromeIdentityService

The goal of those 5 patches is to remove const on the following methods:
 * IsValidIdentity()
 * GetIdentityWithEmail()
 * GetIdentityWithGaiaID()
 * GetCanonicalizeEmailsForAllIdentities()
 * HasIdentities()
 * GetAllIdentities()
 * GetAllIdentitiesSortedForDisplay()

This is required for crrev.com/i/3208484, to not start async identity
fetch in ChromeIdentityServiceImpl instance when the cache is not
populated.

=> crrev.com/c/2345305 Add temporary methods
 * crrev.com/i/3201649 Switch to the temporary methods
 * crrev.com/c/2345146 Remove const in the methods
 * crrev.com/i/3201650 Switch back the original methods
 * crrev.com/c/2344467 Remove temporary methods

Bug: 897470
Change-Id: I96ee862b20081858732fc4d12024bc45d56c3ee8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2345305
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Auto-Submit: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarNohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796437}
parent 5ee7a9c7
...@@ -154,30 +154,40 @@ class ChromeIdentityService { ...@@ -154,30 +154,40 @@ class ChromeIdentityService {
// Returns YES if |identity| is valid and if the service has it in its list of // Returns YES if |identity| is valid and if the service has it in its list of
// identitites. // identitites.
virtual bool IsValidIdentity(ChromeIdentity* identity) const; virtual bool IsValidIdentity(ChromeIdentity* identity) const;
virtual bool IsValidIdentityTemporary(ChromeIdentity* identity) const;
// Returns the chrome identity having the email equal to |email| or |nil| if // Returns the chrome identity having the email equal to |email| or |nil| if
// no matching identity is found. // no matching identity is found.
virtual ChromeIdentity* GetIdentityWithEmail(const std::string& email) const; virtual ChromeIdentity* GetIdentityWithEmail(const std::string& email) const;
virtual ChromeIdentity* GetIdentityWithEmailTemporary(
const std::string& email) const;
// Returns the chrome identity having the gaia ID equal to |gaia_id| or |nil| // Returns the chrome identity having the gaia ID equal to |gaia_id| or |nil|
// if no matching identity is found. // if no matching identity is found.
virtual ChromeIdentity* GetIdentityWithGaiaID( virtual ChromeIdentity* GetIdentityWithGaiaID(
const std::string& gaia_id) const; const std::string& gaia_id) const;
virtual ChromeIdentity* GetIdentityWithGaiaIDTemporary(
const std::string& gaia_id) const;
// Returns the canonicalized emails for all identities. // Returns the canonicalized emails for all identities.
virtual std::vector<std::string> GetCanonicalizeEmailsForAllIdentities() virtual std::vector<std::string> GetCanonicalizeEmailsForAllIdentities()
const; const;
virtual std::vector<std::string>
GetCanonicalizeEmailsForAllIdentitiesTemporary() const;
// Returns true if there is at least one identity. // Returns true if there is at least one identity.
virtual bool HasIdentities() const; virtual bool HasIdentities() const;
virtual bool HasIdentitiesTemporary() const;
// Returns all ChromeIdentity objects in an array. // Returns all ChromeIdentity objects in an array.
virtual NSArray* GetAllIdentities() const; virtual NSArray* GetAllIdentities() const;
virtual NSArray* GetAllIdentitiesTemporary() const;
// Returns all ChromeIdentity objects sorted by the ordering used in the // Returns all ChromeIdentity objects sorted by the ordering used in the
// account manager, which is typically based on the keychain ordering of // account manager, which is typically based on the keychain ordering of
// accounts. // accounts.
virtual NSArray* GetAllIdentitiesSortedForDisplay() const; virtual NSArray* GetAllIdentitiesSortedForDisplay() const;
virtual NSArray* GetAllIdentitiesSortedForDisplayTemporary() const;
// Forgets the given identity on the device. This method logs the user out. // Forgets the given identity on the device. This method logs the user out.
// It is asynchronous because it needs to contact the server to revoke the // It is asynchronous because it needs to contact the server to revoke the
......
...@@ -62,33 +62,66 @@ ChromeIdentityService::CreateChromeIdentityInteractionManager( ...@@ -62,33 +62,66 @@ ChromeIdentityService::CreateChromeIdentityInteractionManager(
} }
bool ChromeIdentityService::IsValidIdentity(ChromeIdentity* identity) const { bool ChromeIdentityService::IsValidIdentity(ChromeIdentity* identity) const {
return IsValidIdentityTemporary(identity);
}
bool ChromeIdentityService::IsValidIdentityTemporary(
ChromeIdentity* identity) const {
return false; return false;
} }
ChromeIdentity* ChromeIdentityService::GetIdentityWithEmail( ChromeIdentity* ChromeIdentityService::GetIdentityWithEmail(
const std::string& email) const { const std::string& email) const {
return GetIdentityWithEmailTemporary(email);
}
ChromeIdentity* ChromeIdentityService::GetIdentityWithEmailTemporary(
const std::string& email) const {
return nil; return nil;
} }
ChromeIdentity* ChromeIdentityService::GetIdentityWithGaiaID( ChromeIdentity* ChromeIdentityService::GetIdentityWithGaiaID(
const std::string& gaia_id) const { const std::string& gaia_id) const {
return GetIdentityWithGaiaIDTemporary(gaia_id);
}
ChromeIdentity* ChromeIdentityService::GetIdentityWithGaiaIDTemporary(
const std::string& gaia_id) const {
return nil; return nil;
} }
std::vector<std::string> std::vector<std::string>
ChromeIdentityService::GetCanonicalizeEmailsForAllIdentities() const { ChromeIdentityService::GetCanonicalizeEmailsForAllIdentities() const {
return GetCanonicalizeEmailsForAllIdentitiesTemporary();
}
std::vector<std::string>
ChromeIdentityService::GetCanonicalizeEmailsForAllIdentitiesTemporary() const {
return std::vector<std::string>(); return std::vector<std::string>();
} }
bool ChromeIdentityService::HasIdentities() const { bool ChromeIdentityService::HasIdentities() const {
return HasIdentitiesTemporary();
}
bool ChromeIdentityService::HasIdentitiesTemporary() const {
return false; return false;
} }
NSArray* ChromeIdentityService::GetAllIdentities() const { NSArray* ChromeIdentityService::GetAllIdentities() const {
return GetAllIdentitiesTemporary();
}
NSArray* ChromeIdentityService::GetAllIdentitiesTemporary() const {
return nil; return nil;
} }
NSArray* ChromeIdentityService::GetAllIdentitiesSortedForDisplay() const { NSArray* ChromeIdentityService::GetAllIdentitiesSortedForDisplay() const {
return GetAllIdentitiesSortedForDisplayTemporary();
}
NSArray* ChromeIdentityService::GetAllIdentitiesSortedForDisplayTemporary()
const {
return nil; return nil;
} }
......
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