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 5fedd953cc6046e86be0fa3c5d4ad4ad04e28ac3..9807da41bbbf41c3d32db4499b81b19a4f44bb76 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| @@ -385,7 +385,7 @@ bool ProfileChooserView::close_on_deactivate_for_testing_ = true; |
| // static |
| void ProfileChooserView::ShowBubble( |
| - BubbleViewMode view_mode, |
| + profiles::BubbleViewMode view_mode, |
| views::View* anchor_view, |
| views::BubbleBorder::Arrow arrow, |
| views::BubbleBorder::BubbleAlignment border_alignment, |
| @@ -418,7 +418,7 @@ ProfileChooserView::ProfileChooserView(views::View* anchor_view, |
| views::BubbleBorder::Arrow arrow, |
| const gfx::Rect& anchor_rect, |
| Browser* browser, |
| - BubbleViewMode view_mode) |
| + profiles::BubbleViewMode view_mode) |
| : BubbleDelegateView(anchor_view, arrow), |
| browser_(browser), |
| view_mode_(view_mode), |
| @@ -487,32 +487,32 @@ 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_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || |
| - view_mode_ == BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
| - view_mode_ == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT) { |
| - ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| + if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || |
| + view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
| + view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT) { |
| + ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| } |
| } |
| void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { |
| // Refresh the account management view when an account is removed from the |
| // profile. |
| - if (view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) |
| - ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| + if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) |
| + ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| } |
| -void ProfileChooserView::ShowView(BubbleViewMode view_to_display, |
| +void ProfileChooserView::ShowView(profiles::BubbleViewMode view_to_display, |
| AvatarMenu* avatar_menu) { |
| // The account management view should only be displayed if the active profile |
| // is signed in. |
| - if (view_to_display == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
| + if (view_to_display == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
| const AvatarMenu::Item& active_item = avatar_menu->GetItemAt( |
| avatar_menu->GetActiveProfileIndex()); |
| DCHECK(active_item.signed_in); |
| } |
| // Records the last tutorial mode. |
| - TutorialMode last_tutorial_mode = tutorial_mode_; |
| + profiles::TutorialMode last_tutorial_mode = tutorial_mode_; |
| ResetView(); |
| RemoveAllChildViews(true); |
| view_mode_ = view_to_display; |
| @@ -520,17 +520,17 @@ void ProfileChooserView::ShowView(BubbleViewMode view_to_display, |
| views::GridLayout* layout; |
| views::View* sub_view; |
| switch (view_mode_) { |
| - case BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
| - case BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: |
| + case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
| + case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: |
| layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); |
| sub_view = CreateGaiaSigninView( |
| view_mode_ == BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT); |
| break; |
| - case BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: |
| + case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: |
| layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); |
| sub_view = CreateAccountRemovalView(); |
| break; |
| - case BUBBLE_VIEW_MODE_END_PREVIEW: |
| + case profiles::BUBBLE_VIEW_MODE_END_PREVIEW: |
| layout = CreateSingleColumnLayout(this, kFixedEndPreviewViewWidth); |
| sub_view = CreateEndPreviewView(); |
| break; |
| @@ -579,7 +579,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| ProfileMetrics::LogProfileUpgradeEnrollment( |
| ProfileMetrics::PROFILE_ENROLLMENT_CLOSE_WELCOME_CARD); |
| - ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| } else if (sender == tutorial_enable_new_profile_management_button_) { |
| ProfileMetrics::LogProfileUpgradeEnrollment( |
| ProfileMetrics::PROFILE_ENROLLMENT_ACCEPT_NEW_PROFILE_MGMT); |
| @@ -588,7 +588,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| RemoveAccount(); |
| } else if (sender == account_removal_cancel_button_) { |
| account_id_to_remove_.clear(); |
| - ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| } else if (sender == gaia_signin_cancel_button_) { |
| std::string primary_account = |
| SigninManagerFactory::GetForProfile(browser_->profile())-> |
| @@ -598,7 +598,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| avatar_menu_.get()); |
| } else if (sender == question_mark_button_) { |
| tutorial_mode_ = TUTORIAL_MODE_SEND_FEEDBACK; |
| - ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| } else if (sender == tutorial_send_feedback_button_) { |
| ProfileMetrics::LogProfileUpgradeEnrollment( |
| ProfileMetrics::PROFILE_ENROLLMENT_SEND_FEEDBACK); |
| @@ -609,7 +609,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| profiles::DisableNewProfileManagementPreview(); |
| } else if (sender == end_preview_cancel_button_) { |
| tutorial_mode_ = TUTORIAL_MODE_SEND_FEEDBACK; |
| - ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| } else if (current_profile_photo_ && |
| sender == current_profile_photo_->change_photo_button()) { |
| avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); |
| @@ -617,7 +617,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| // Only show the inline signin if the new UI flag is flipped. Otherwise, |
| // use the tab signin page. |
| if (switches::IsNewProfileManagement()) |
| - ShowView(BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); |
| else |
| chrome::ShowBrowserSignin(browser_, signin::SOURCE_MENU); |
| } else { |
| @@ -636,7 +636,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
| current_profile_accounts_map_.find(sender); |
| DCHECK(account_match != current_profile_accounts_map_.end()); |
| account_id_to_remove_ = account_match->second; |
| - ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get()); |
| } |
| } |
| } |
| @@ -650,7 +650,7 @@ void ProfileChooserView::RemoveAccount() { |
| oauth2_token_service->RevokeCredentials(account_id_to_remove_); |
| account_id_to_remove_.clear(); |
| - ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| } |
| void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
| @@ -659,9 +659,9 @@ void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
| // depending on which view it is displayed. ShowView() will DCHECK if |
| // the account management view is displayed for non signed-in users. |
| ShowView( |
| - view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? |
| - BUBBLE_VIEW_MODE_PROFILE_CHOOSER : |
| - BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, |
| + view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? |
| + profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : |
| + profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, |
| avatar_menu_.get()); |
| } else if (sender == add_account_link_) { |
| ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); |
| @@ -678,7 +678,7 @@ void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
| chrome::Navigate(¶ms); |
| } else { |
| DCHECK(sender == tutorial_end_preview_link_); |
| - ShowView(BUBBLE_VIEW_MODE_END_PREVIEW, avatar_menu_.get()); |
| + ShowView(profiles::BUBBLE_VIEW_MODE_END_PREVIEW, avatar_menu_.get()); |
| } |
| } |
| @@ -718,7 +718,7 @@ bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, |
| views::View* ProfileChooserView::CreateProfileChooserView( |
| AvatarMenu* avatar_menu, |
| - TutorialMode last_tutorial_mode) { |
| + profiles::TutorialMode last_tutorial_mode) { |
| // TODO(guohui, noms): the view should be customized based on whether new |
| // profile management preview is enabled or not. |
| @@ -736,12 +736,15 @@ views::View* ProfileChooserView::CreateProfileChooserView( |
| if (item.active) { |
| option_buttons_view = CreateOptionsView(item.signed_in); |
| current_profile_view = CreateCurrentProfileView(item, false); |
| - if (view_mode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
| + if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
| if (is_new_profile_management) { |
| - tutorial_view = last_tutorial_mode == TUTORIAL_MODE_SEND_FEEDBACK ? |
| + tutorial_view = |
| + last_tutorial_mode == profiles::TUTORIAL_MODE_SEND_FEEDBACK ? |
| CreateSendPreviewFeedbackView() : |
| CreatePreviewEnabledTutorialView( |
| - item, last_tutorial_mode == TUTORIAL_MODE_PREVIEW_ENABLED); |
| + item, |
| + last_tutorial_mode == |
| + profiles::TUTORIAL_MODE_WELCOME); |
|
msw
2014/05/21 19:42:47
nit: fits on the line above.
Mike Lerman
2014/05/21 19:53:10
Done.
|
| } else { |
| tutorial_view = CreateNewProfileManagementPreviewView(); |
| } |
| @@ -818,7 +821,7 @@ views::View* ProfileChooserView::CreatePreviewEnabledTutorialView( |
| } |
| return CreateTutorialView( |
| - TUTORIAL_MODE_PREVIEW_ENABLED, |
| + TUTORIAL_MODE_WELCOME, |
| l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE), |
| l10n_util::GetStringUTF16( |
| IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT), |
| @@ -841,7 +844,7 @@ views::View* ProfileChooserView::CreateSendPreviewFeedbackView() { |
| } |
| views::View* ProfileChooserView::CreateTutorialView( |
| - TutorialMode tutorial_mode, |
| + profiles::TutorialMode tutorial_mode, |
| const base::string16& title_text, |
| const base::string16& content_text, |
| const base::string16& link_text, |