Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| index 66a55719ec94ddaab18f3f6e8c1ae232c26d8318..e1e8ddf418fbf7692a7bf1ccce66b14deb31ee68 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| @@ -418,11 +418,18 @@ ProfileChooserView::ProfileChooserView(views::View* anchor_view, |
| BubbleViewMode view_mode) |
| : BubbleDelegateView(anchor_view, arrow), |
| browser_(browser), |
| - view_mode_(view_mode), |
| tutorial_mode_(TUTORIAL_MODE_NONE) { |
| // Reset the default margins inherited from the BubbleDelegateView. |
| set_margins(gfx::Insets()); |
| + if (view_mode == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT_FROM_HEADER) { |
| + view_mode = BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
|
sky
2014/05/13 16:34:37
Can you set both view_mode_ and opened_from_header
Mike Lerman
2014/05/13 16:57:55
Done.
|
| + opened_from_header_ = true; |
| + } else { |
| + opened_from_header_ = false; |
| + } |
| + view_mode_ = view_mode; |
| + |
| ResetView(); |
| avatar_menu_.reset(new AvatarMenu( |
| @@ -435,6 +442,8 @@ ProfileChooserView::ProfileChooserView(views::View* anchor_view, |
| ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); |
| if (oauth2_token_service) |
| oauth2_token_service->AddObserver(this); |
| + |
| + opened_from_header_ = (view_mode == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT); |
| } |
| ProfileChooserView::~ProfileChooserView() { |
| @@ -565,6 +574,8 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| if (browser_->profile()->IsGuestSession()) |
| profiles::CloseGuestProfileWindows(); |
| } else if (sender == lock_button_) { |
| + ProfileMetrics::LogProfileDesktopSignout( |
| + ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK, opened_from_header_); |
| profiles::LockProfile(browser_->profile()); |
| } else if (sender == tutorial_ok_button_) { |
| // If the user manually dismissed the tutorial, never show it again by |
| @@ -619,12 +630,17 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| ButtonIndexes::const_iterator profile_match = |
| open_other_profile_indexes_map_.find(sender); |
| if (profile_match != open_other_profile_indexes_map_.end()) { |
| + ProfileMetrics::LogProfileDesktopSignout( |
| + ProfileMetrics::PROFILE_DESKTOP_MENU_SWITCH, opened_from_header_); |
| avatar_menu_->SwitchToProfile( |
| profile_match->second, |
| ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, |
| ProfileMetrics::SWITCH_PROFILE_ICON); |
| } else { |
| // This was a profile accounts button. |
| + ProfileMetrics::LogProfileDesktopSignout( |
| + ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT, |
| + opened_from_header_); |
| AccountButtonIndexes::const_iterator account_match = |
| current_profile_accounts_map_.find(sender); |
| DCHECK(account_match != current_profile_accounts_map_.end()); |
| @@ -657,6 +673,8 @@ void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
| BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, |
| avatar_menu_.get()); |
| } else if (sender == add_account_link_) { |
| + ProfileMetrics::LogProfileDesktopSignout( |
| + ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT, opened_from_header_); |
| ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); |
| } else if (sender == tutorial_learn_more_link_) { |
| ProfileMetrics::LogProfileUpgradeEnrollment( |