Skip to content

Commit

Permalink
TraySupervisedUser observe user add/switch
Browse files Browse the repository at this point in the history
TraySupervisedUser should observe user session addition and
switch as well as the user session update. Otherwise, it might
miss some session info as in http://crbug.com/796758, where
user child info is now only set at user session creation with
no user session update followed.

Bug: 796758
Change-Id: Ic275ccfa174a21451077e6ec9225901f188e2a63
Reviewed-on: https://chromium-review.googlesource.com/848020
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527057}
  • Loading branch information
Xiyuan Xia authored and Commit Bot committed Jan 4, 2018
1 parent 8237d65 commit b910d51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ash/system/supervised/tray_supervised_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ views::View* TraySupervisedUser::CreateDefaultView(LoginStatus status) {
return tray_view;
}

void TraySupervisedUser::OnActiveUserSessionChanged(
const AccountId& account_id) {
OnUserSessionUpdated(account_id);
}

void TraySupervisedUser::OnUserSessionAdded(const AccountId& account_id) {
OnUserSessionUpdated(account_id);
}

void TraySupervisedUser::OnUserSessionUpdated(const AccountId& account_id) {
// NOTE: This doesn't use OnUserSessionAdded() because the custodian info
// isn't available until after the session starts.
SessionController* session_controller = Shell::Get()->session_controller();
if (!session_controller->IsUserSupervised())
return;
Expand Down
2 changes: 2 additions & 0 deletions ash/system/supervised/tray_supervised_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class ASH_EXPORT TraySupervisedUser : public SystemTrayItem,
views::View* CreateDefaultView(LoginStatus status) override;

// SessionObserver:
void OnActiveUserSessionChanged(const AccountId& account_id) override;
void OnUserSessionAdded(const AccountId& account_id) override;
void OnUserSessionUpdated(const AccountId& account_id) override;

private:
Expand Down

0 comments on commit b910d51

Please sign in to comment.