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-on: https://chromium-review.googlesource.com/c/chromium/src/+/1667747
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Ryan Hansberry <hansberry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672164}
12 files changed