Commit 2f543624 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Add profile heading

Screenshot:
https://drive.google.com/file/d/13LQ5jov5tzc__Q1X-xUq-FX9Ptet2i9y/view?usp=sharing

Flag: profile-menu-revamp

Note: String is subject to change.

Bug: 995720
Change-Id: I2658c66897fe899a16355bdced923e32d8c4cf87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1811117
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697655}
parent e34c590c
...@@ -172,6 +172,7 @@ void ProfileMenuView::BuildMenu() { ...@@ -172,6 +172,7 @@ void ProfileMenuView::BuildMenu() {
BuildSyncInfo(); BuildSyncInfo();
BuildAutofillButtons(); BuildAutofillButtons();
BuildAccountFeatureButtons(); BuildAccountFeatureButtons();
BuildProfileHeading();
BuildSelectableProfiles(); BuildSelectableProfiles();
BuildProfileFeatureButtons(); BuildProfileFeatureButtons();
} }
...@@ -487,6 +488,12 @@ void ProfileMenuView::BuildAccountFeatureButtons() { ...@@ -487,6 +488,12 @@ void ProfileMenuView::BuildAccountFeatureButtons() {
} }
} }
void ProfileMenuView::BuildProfileHeading() {
// TODO(crbug.com/995720): Update this string after approval from UX.
SetProfileHeading(
l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON));
}
void ProfileMenuView::BuildSelectableProfiles() { void ProfileMenuView::BuildSelectableProfiles() {
auto profile_entries = g_browser_process->profile_manager() auto profile_entries = g_browser_process->profile_manager()
->GetProfileAttributesStorage() ->GetProfileAttributesStorage()
......
...@@ -104,6 +104,7 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -104,6 +104,7 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
void BuildAutofillButtons(); void BuildAutofillButtons();
void BuildSyncInfo(); void BuildSyncInfo();
void BuildAccountFeatureButtons(); void BuildAccountFeatureButtons();
void BuildProfileHeading();
void BuildSelectableProfiles(); void BuildSelectableProfiles();
void BuildProfileFeatureButtons(); void BuildProfileFeatureButtons();
......
...@@ -331,6 +331,19 @@ void ProfileMenuViewBase::AddAccountFeatureButton( ...@@ -331,6 +331,19 @@ void ProfileMenuViewBase::AddAccountFeatureButton(
RegisterClickAction(button, std::move(action)); RegisterClickAction(button, std::move(action));
} }
void ProfileMenuViewBase::SetProfileHeading(const base::string16& heading) {
profile_heading_container_->RemoveAllChildViews(/*delete_children=*/true);
profile_heading_container_->SetLayoutManager(
std::make_unique<views::FillLayout>());
views::Label* label =
profile_heading_container_->AddChildView(std::make_unique<views::Label>(
heading, views::style::CONTEXT_LABEL, STYLE_HINT));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetHandlesTooltips(false);
label->SetBorder(views::CreateEmptyBorder(gfx::Insets(0, kMenuEdgeMargin)));
}
void ProfileMenuViewBase::AddSelectableProfile(const gfx::Image& image, void ProfileMenuViewBase::AddSelectableProfile(const gfx::Image& image,
const base::string16& name, const base::string16& name,
base::RepeatingClosure action) { base::RepeatingClosure action) {
...@@ -487,6 +500,8 @@ void ProfileMenuViewBase::Reset() { ...@@ -487,6 +500,8 @@ void ProfileMenuViewBase::Reset() {
components->AddChildView( components->AddChildView(
CreateBorderedBoxView(std::move(bordered_box_container))); CreateBorderedBoxView(std::move(bordered_box_container)));
profile_heading_container_ =
components->AddChildView(std::make_unique<views::View>());
selectable_profiles_container_ = selectable_profiles_container_ =
components->AddChildView(std::make_unique<views::View>()); components->AddChildView(std::make_unique<views::View>());
profile_features_container_ = profile_features_container_ =
......
...@@ -107,6 +107,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -107,6 +107,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
void AddAccountFeatureButton(const gfx::ImageSkia& icon, void AddAccountFeatureButton(const gfx::ImageSkia& icon,
const base::string16& text, const base::string16& text,
base::RepeatingClosure action); base::RepeatingClosure action);
void SetProfileHeading(const base::string16& heading);
void AddSelectableProfile(const gfx::Image& image, void AddSelectableProfile(const gfx::Image& image,
const base::string16& name, const base::string16& name,
base::RepeatingClosure action); base::RepeatingClosure action);
...@@ -223,6 +224,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -223,6 +224,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
views::View* sync_info_container_ = nullptr; views::View* sync_info_container_ = nullptr;
views::View* shortcut_features_container_ = nullptr; views::View* shortcut_features_container_ = nullptr;
views::View* account_features_container_ = nullptr; views::View* account_features_container_ = nullptr;
views::View* profile_heading_container_ = nullptr;
views::View* selectable_profiles_container_ = nullptr; views::View* selectable_profiles_container_ = nullptr;
views::View* profile_features_container_ = nullptr; views::View* profile_features_container_ = nullptr;
......
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