Commit 38b5795d authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Update guest profile menu

 - The profile feature buttons are added
 - Browser tests for the guest profile are
   re-enabled after crrev.com/c/1848371
 - Autofill buttons are not shown in incognito mode
 - The guest profile is moved to selectable profiles

Bug: 995720
Change-Id: I8499848add6fcc06bb984ce79c4bc5f36ac4546a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1850155Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704608}
parent 09a46b5c
...@@ -178,17 +178,17 @@ void ProfileMenuView::BuildMenu() { ...@@ -178,17 +178,17 @@ void ProfileMenuView::BuildMenu() {
BuildSyncInfo(); BuildSyncInfo();
BuildAccountFeatureButtons(); BuildAccountFeatureButtons();
BuildAutofillButtons(); BuildAutofillButtons();
BuildProfileFeatureButtons();
} else if (profile->IsIncognitoProfile()) { } else if (profile->IsIncognitoProfile()) {
BuildIncognitoIdentity(); BuildIncognitoIdentity();
BuildAutofillButtons(); } else if (profile->IsGuestSession()) {
} else {
DCHECK(profile->IsGuestSession());
BuildGuestIdentity(); BuildGuestIdentity();
} else {
NOTREACHED();
} }
BuildProfileHeading(); BuildProfileHeading();
BuildSelectableProfiles(); BuildSelectableProfiles();
BuildProfileFeatureButtons();
} }
void ProfileMenuView::OnAvatarMenuChanged( void ProfileMenuView::OnAvatarMenuChanged(
...@@ -610,6 +610,14 @@ void ProfileMenuView::BuildSelectableProfiles() { ...@@ -610,6 +610,14 @@ void ProfileMenuView::BuildSelectableProfiles() {
base::BindRepeating(&ProfileMenuView::OnOtherProfileSelected, base::BindRepeating(&ProfileMenuView::OnOtherProfileSelected,
base::Unretained(this), profile_entry->GetPath())); base::Unretained(this), profile_entry->GetPath()));
} }
if (!browser()->profile()->IsGuestSession()) {
AddSelectableProfile(
profiles::GetGuestAvatar(),
l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME),
base::BindRepeating(&ProfileMenuView::OnGuestProfileButtonClicked,
base::Unretained(this)));
}
} }
void ProfileMenuView::BuildProfileFeatureButtons() { void ProfileMenuView::BuildProfileFeatureButtons() {
...@@ -619,12 +627,6 @@ void ProfileMenuView::BuildProfileFeatureButtons() { ...@@ -619,12 +627,6 @@ void ProfileMenuView::BuildProfileFeatureButtons() {
base::BindRepeating(&ProfileMenuView::OnManageProfilesButtonClicked, base::BindRepeating(&ProfileMenuView::OnManageProfilesButtonClicked,
base::Unretained(this))); base::Unretained(this)));
AddProfileFeatureButton(
profiles::GetGuestAvatar(),
l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME),
base::BindRepeating(&ProfileMenuView::OnGuestProfileButtonClicked,
base::Unretained(this)));
AddProfileFeatureButton( AddProfileFeatureButton(
ImageForMenu(kAddIcon, /*icon_to_image_ratio=*/0.75), ImageForMenu(kAddIcon, /*icon_to_image_ratio=*/0.75),
l10n_util::GetStringUTF16(IDS_ADD), l10n_util::GetStringUTF16(IDS_ADD),
......
...@@ -928,11 +928,13 @@ class ProfileMenuClickTest_GuestProfile : public ProfileMenuClickTest { ...@@ -928,11 +928,13 @@ class ProfileMenuClickTest_GuestProfile : public ProfileMenuClickTest {
public: public:
// List of actionable items in the correct order as they appear in the menu. // List of actionable items in the correct order as they appear in the menu.
// If a new button is added to the menu, it should also be added to this list. // If a new button is added to the menu, it should also be added to this list.
static constexpr ProfileMenuView::ActionableItem kOrderedActionableItems[2] = static constexpr ProfileMenuView::ActionableItem kOrderedActionableItems[4] =
{ProfileMenuView::ActionableItem::kOtherProfileButton, {ProfileMenuView::ActionableItem::kManageProfilesButton,
ProfileMenuView::ActionableItem::kOtherProfileButton,
ProfileMenuView::ActionableItem::kAddNewProfileButton,
// The first button is added again to finish the cycle and test that // The first button is added again to finish the cycle and test that
// there are no other buttons at the end. // there are no other buttons at the end.
ProfileMenuView::ActionableItem::kOtherProfileButton}; ProfileMenuView::ActionableItem::kManageProfilesButton};
ProfileMenuClickTest_GuestProfile() = default; ProfileMenuClickTest_GuestProfile() = default;
...@@ -948,9 +950,7 @@ class ProfileMenuClickTest_GuestProfile : public ProfileMenuClickTest { ...@@ -948,9 +950,7 @@ class ProfileMenuClickTest_GuestProfile : public ProfileMenuClickTest {
constexpr ProfileMenuView::ActionableItem constexpr ProfileMenuView::ActionableItem
ProfileMenuClickTest_GuestProfile::kOrderedActionableItems[]; ProfileMenuClickTest_GuestProfile::kOrderedActionableItems[];
// TODO(crbug.com/1012167): Flaky. IN_PROC_BROWSER_TEST_P(ProfileMenuClickTest_GuestProfile, SetupAndRunTest) {
IN_PROC_BROWSER_TEST_P(ProfileMenuClickTest_GuestProfile,
DISABLED_SetupAndRunTest) {
profiles::SwitchToGuestProfile(ProfileManager::CreateCallback()); profiles::SwitchToGuestProfile(ProfileManager::CreateCallback());
ui_test_utils::WaitForBrowserToOpen(); ui_test_utils::WaitForBrowserToOpen();
Profile* guest = g_browser_process->profile_manager()->GetProfileByPath( Profile* guest = g_browser_process->profile_manager()->GetProfileByPath(
......
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