AccountId: Enforce canonicalized email via DCHECK().

Different AccountId objects were being built with either raw or
canonicalized emails (canonicalized emails remove characters not used
for identification, such as periods). Without this change, two separate
AccountId objects with a raw and canonicalized email won't be recognized
as equal and won't have the same hash, even though they have effectively
the same email and in fact should.

This change fixes callers of the constructor which were passing
raw emails; notably, account_info's AccountIdFromAccountInfo() is
tweaked to canonicalize the email. If the platform is Chrome OS,
user_manager::known_user::GetAccount() is used instead for the extra
checks it provides.

Bug: 953027
Change-Id: I8491698fdd005e79c564efcc0256c0b975f33065
Reviewed-by: Steven Bennetts <>
Reviewed-by: Roger Tawa <>
Reviewed-by: Boris Sazonov <>
Reviewed-by: Alexander Alekseev <>
Reviewed-by: Xiyuan Xia <>
Reviewed-by: Kyle Horimoto <>
Commit-Queue: Ryan Hansberry <>
Cr-Commit-Position: refs/heads/master@{#672164}
12 files changed