Commit 24698c67 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Add != operator for AccountManager::AccountKey

Also add a note about AccountManager::UpsertToken being idempotent.

Bug: 904128
Bug: 820046
Change-Id: Ie9cc135edf2afad2d9da3c13df5fbc6fc822c4ad
Reviewed-on: https://chromium-review.googlesource.com/c/1349224Reviewed-by: default avatarDrew Wilson <atwilson@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610606}
parent b46ad28d
...@@ -161,6 +161,10 @@ bool AccountManager::AccountKey::operator==(const AccountKey& other) const { ...@@ -161,6 +161,10 @@ bool AccountManager::AccountKey::operator==(const AccountKey& other) const {
return id == other.id && account_type == other.account_type; return id == other.id && account_type == other.account_type;
} }
bool AccountManager::AccountKey::operator!=(const AccountKey& other) const {
return !(*this == other);
}
AccountManager::Observer::Observer() = default; AccountManager::Observer::Observer() = default;
AccountManager::Observer::~Observer() = default; AccountManager::Observer::~Observer() = default;
......
...@@ -50,6 +50,7 @@ class CHROMEOS_EXPORT AccountManager { ...@@ -50,6 +50,7 @@ class CHROMEOS_EXPORT AccountManager {
bool operator<(const AccountKey& other) const; bool operator<(const AccountKey& other) const;
bool operator==(const AccountKey& other) const; bool operator==(const AccountKey& other) const;
bool operator!=(const AccountKey& other) const;
}; };
// A map from |AccountKey| to a raw token. // A map from |AccountKey| to a raw token.
...@@ -121,6 +122,7 @@ class CHROMEOS_EXPORT AccountManager { ...@@ -121,6 +122,7 @@ class CHROMEOS_EXPORT AccountManager {
// Updates or inserts a token, for the account corresponding to the given // Updates or inserts a token, for the account corresponding to the given
// |account_key|. |account_key| must be valid (|AccountKey::IsValid|). // |account_key|. |account_key| must be valid (|AccountKey::IsValid|).
// This API is idempotent.
void UpsertToken(const AccountKey& account_key, const std::string& token); void UpsertToken(const AccountKey& account_key, const std::string& token);
// Add a non owning pointer to an |AccountManager::Observer|. // Add a non owning pointer to an |AccountManager::Observer|.
......
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