Chromium Code Reviews| Index: chrome/browser/ui/views/profile_chooser_view.cc |
| diff --git a/chrome/browser/ui/views/profile_chooser_view.cc b/chrome/browser/ui/views/profile_chooser_view.cc |
| index fd0ea67dfc43d0f1a482c9acd1733a7aa8a34d20..763cb44a07265741f640909dff4df096f66fb70b 100644 |
| --- a/chrome/browser/ui/views/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profile_chooser_view.cc |
| @@ -234,9 +234,15 @@ ProfileChooserView::ProfileChooserView(views::View* anchor_view, |
| this, |
| browser_)); |
| avatar_menu_->RebuildMenu(); |
| + |
| + Profile* profile = browser_->profile(); |
| + ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->AddObserver(this); |
| } |
| ProfileChooserView::~ProfileChooserView() { |
| + Profile* profile = browser_->profile(); |
| + ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
| + RemoveObserver(this); |
| } |
| void ProfileChooserView::ResetLinksAndButtons() { |
| @@ -264,6 +270,23 @@ void ProfileChooserView::OnAvatarMenuChanged( |
| ShowView(PROFILE_CHOOSER_VIEW, avatar_menu); |
| } |
| +void ProfileChooserView::OnRefreshTokenAvailable( |
| + const std::string& account_id) { |
| + // Refresh the account management view when a new account is added to the |
| + // profile. |
| + if (view_mode_ == ACCOUNT_MANAGEMENT_VIEW || |
| + view_mode_ == GAIA_SIGNIN_VIEW || |
| + view_mode_ == GAIA_ADD_ACCOUNT_VIEW) |
| + ShowView(ACCOUNT_MANAGEMENT_VIEW, avatar_menu_.get()); |
|
Roger Tawa OOO till Jul 10th
2013/11/04 19:13:14
Should add { and } around if block.
guohui
2013/11/04 19:56:32
Done.
|
| +} |
| + |
| +void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { |
| + // Refresh the account management view when an account is removed from the |
| + // profile. |
| + if (view_mode_ == ACCOUNT_MANAGEMENT_VIEW) |
| + ShowView(ACCOUNT_MANAGEMENT_VIEW, avatar_menu_.get()); |
| +} |
| + |
| void ProfileChooserView::ShowView(BubbleViewMode view_to_display, |
| AvatarMenu* avatar_menu) { |
| // The account management view should only be displayed if the active profile |
| @@ -276,6 +299,7 @@ void ProfileChooserView::ShowView(BubbleViewMode view_to_display, |
| ResetLinksAndButtons(); |
| RemoveAllChildViews(true); |
| + view_mode_ = view_to_display; |
| views::GridLayout* layout = CreateSingleColumnLayout(this); |
| layout->set_minimum_size(gfx::Size(kMinMenuWidth, 0)); |