Commit 899655fb authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Update avatar button when profile count changes

The generic icon should be shown when there's only one (non-signed in)
user. We need to listen for add/remove profile events so we can detect
whether a generic icon should be shown or not for existing windows as
well.

Bug: chromium:822070
Change-Id: Ia84feb13dd10b4459aeff326e2fd6e1d29698a76
Reviewed-on: https://chromium-review.googlesource.com/1028981Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553912}
parent 90e6d701
...@@ -71,6 +71,20 @@ void AvatarToolbarButton::OnAvatarErrorChanged() { ...@@ -71,6 +71,20 @@ void AvatarToolbarButton::OnAvatarErrorChanged() {
UpdateIcon(); UpdateIcon();
} }
void AvatarToolbarButton::OnProfileAdded(const base::FilePath& profile_path) {
// Adding any profile changes the profile count, we might go from showing a
// generic avatar button to profile pictures here. Update icon accordingly.
UpdateIcon();
}
void AvatarToolbarButton::OnProfileWasRemoved(
const base::FilePath& profile_path,
const base::string16& profile_name) {
// Removing a profile changes the profile count, we might go from showing
// per-profile icons back to a generic avatar icon. Update icon accordingly.
UpdateIcon();
}
void AvatarToolbarButton::OnProfileAvatarChanged( void AvatarToolbarButton::OnProfileAvatarChanged(
const base::FilePath& profile_path) { const base::FilePath& profile_path) {
UpdateIcon(); UpdateIcon();
......
...@@ -27,6 +27,9 @@ class AvatarToolbarButton : public ToolbarButton, ...@@ -27,6 +27,9 @@ class AvatarToolbarButton : public ToolbarButton,
void OnAvatarErrorChanged() override; void OnAvatarErrorChanged() override;
// ProfileAttributesStorage::Observer: // ProfileAttributesStorage::Observer:
void OnProfileAdded(const base::FilePath& profile_path) override;
void OnProfileWasRemoved(const base::FilePath& profile_path,
const base::string16& profile_name) override;
void OnProfileAvatarChanged(const base::FilePath& profile_path) override; void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
void OnProfileHighResAvatarLoaded( void OnProfileHighResAvatarLoaded(
const base::FilePath& profile_path) override; const base::FilePath& profile_path) override;
......
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