Commit c4cc9e81 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Mark removable code after ProfileMenuRevamp

Bug: 1021587, 993752
Change-Id: Id0b9adcfa72c5c9567a315dc7bada293a2bdbe52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899880
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Auto-Submit: Thomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720213}
parent 166a3912
...@@ -66,6 +66,7 @@ namespace { ...@@ -66,6 +66,7 @@ namespace {
constexpr float kShortcutIconToImageRatio = 9.0 / 16.0; constexpr float kShortcutIconToImageRatio = 9.0 / 16.0;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Number of times the Dice sign-in promo illustration should be shown. // Number of times the Dice sign-in promo illustration should be shown.
constexpr int kDiceSigninPromoIllustrationShowCountMax = 10; constexpr int kDiceSigninPromoIllustrationShowCountMax = 10;
...@@ -77,6 +78,7 @@ ProfileAttributesEntry* GetProfileAttributesEntry(Profile* profile) { ...@@ -77,6 +78,7 @@ ProfileAttributesEntry* GetProfileAttributesEntry(Profile* profile) {
return entry; return entry;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
BadgedProfilePhoto::BadgeType GetProfileBadgeType(Profile* profile) { BadgedProfilePhoto::BadgeType GetProfileBadgeType(Profile* profile) {
if (profile->IsSupervised()) { if (profile->IsSupervised()) {
return profile->IsChild() ? BadgedProfilePhoto::BADGE_TYPE_CHILD return profile->IsChild() ? BadgedProfilePhoto::BADGE_TYPE_CHILD
...@@ -114,6 +116,7 @@ bool AreSigninCookiesClearedOnExit(Profile* profile) { ...@@ -114,6 +116,7 @@ bool AreSigninCookiesClearedOnExit(Profile* profile) {
return client->AreSigninCookiesDeletedOnExit(); return client->AreSigninCookiesDeletedOnExit();
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Returns the Google G icon in grey and with a padding of 2. The padding is // Returns the Google G icon in grey and with a padding of 2. The padding is
// needed to make the icon look smaller, otherwise it looks too big compared to // needed to make the icon look smaller, otherwise it looks too big compared to
...@@ -182,11 +185,13 @@ ProfileMenuView::ProfileMenuView(views::Button* anchor_button, ...@@ -182,11 +185,13 @@ ProfileMenuView::ProfileMenuView(views::Button* anchor_button,
ProfileMenuView::~ProfileMenuView() = default; ProfileMenuView::~ProfileMenuView() = default;
void ProfileMenuView::BuildMenu() { void ProfileMenuView::BuildMenu() {
// TODO(crbug.com/993752): Remove after ProfileMenuRevamp.
avatar_menu_ = std::make_unique<AvatarMenu>( avatar_menu_ = std::make_unique<AvatarMenu>(
&g_browser_process->profile_manager()->GetProfileAttributesStorage(), &g_browser_process->profile_manager()->GetProfileAttributesStorage(),
this, browser()); this, browser());
avatar_menu_->RebuildMenu(); avatar_menu_->RebuildMenu();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
if (!base::FeatureList::IsEnabled(features::kProfileMenuRevamp)) { if (!base::FeatureList::IsEnabled(features::kProfileMenuRevamp)) {
if (dice_enabled_) { if (dice_enabled_) {
// Fetch DICE accounts. Note: This always includes the primary account if // Fetch DICE accounts. Note: This always includes the primary account if
...@@ -215,16 +220,18 @@ void ProfileMenuView::BuildMenu() { ...@@ -215,16 +220,18 @@ void ProfileMenuView::BuildMenu() {
BuildProfileManagementFeatureButtons(); BuildProfileManagementFeatureButtons();
} }
// TODO(crbug.com/993752): Remove after ProfileMenuRevamp.
void ProfileMenuView::OnAvatarMenuChanged( void ProfileMenuView::OnAvatarMenuChanged(
AvatarMenu* avatar_menu) { AvatarMenu* avatar_menu) {
// TODO(crbug.com/993752): Remove AvatarMenu observer.
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::FocusButtonOnKeyboardOpen() { void ProfileMenuView::FocusButtonOnKeyboardOpen() {
if (first_profile_button_) if (first_profile_button_)
first_profile_button_->RequestFocus(); first_profile_button_->RequestFocus();
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::OnWidgetClosing(views::Widget* /*widget*/) { void ProfileMenuView::OnWidgetClosing(views::Widget* /*widget*/) {
// Unsubscribe from everything early so that the updates do not reach the // Unsubscribe from everything early so that the updates do not reach the
// bubble and change its state. // bubble and change its state.
...@@ -294,6 +301,7 @@ void ProfileMenuView::OnManageProfilesButtonClicked() { ...@@ -294,6 +301,7 @@ void ProfileMenuView::OnManageProfilesButtonClicked() {
PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER);
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::OnLockButtonClicked() { void ProfileMenuView::OnLockButtonClicked() {
RecordClick(ActionableItem::kLockButton); RecordClick(ActionableItem::kLockButton);
profiles::LockProfile(browser()->profile()); profiles::LockProfile(browser()->profile());
...@@ -362,6 +370,7 @@ void ProfileMenuView::OnSyncErrorButtonClicked( ...@@ -362,6 +370,7 @@ void ProfileMenuView::OnSyncErrorButtonClicked(
} }
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::OnCurrentProfileCardClicked() { void ProfileMenuView::OnCurrentProfileCardClicked() {
RecordClick(ActionableItem::kCurrentProfileCard); RecordClick(ActionableItem::kCurrentProfileCard);
if (dice_enabled_ && if (dice_enabled_ &&
...@@ -697,6 +706,7 @@ void ProfileMenuView::BuildProfileManagementFeatureButtons() { ...@@ -697,6 +706,7 @@ void ProfileMenuView::BuildProfileManagementFeatureButtons() {
} }
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::AddProfileMenuView(AvatarMenu* avatar_menu) { void ProfileMenuView::AddProfileMenuView(AvatarMenu* avatar_menu) {
// Separate items into active and alternatives. // Separate items into active and alternatives.
const AvatarMenu::Item* active_item = nullptr; const AvatarMenu::Item* active_item = nullptr;
...@@ -735,6 +745,7 @@ void ProfileMenuView::AddProfileMenuView(AvatarMenu* avatar_menu) { ...@@ -735,6 +745,7 @@ void ProfileMenuView::AddProfileMenuView(AvatarMenu* avatar_menu) {
AddOptionsView(display_lock, avatar_menu); AddOptionsView(display_lock, avatar_menu);
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
bool ProfileMenuView::AddSyncErrorViewIfNeeded( bool ProfileMenuView::AddSyncErrorViewIfNeeded(
const AvatarMenu::Item& avatar_item) { const AvatarMenu::Item& avatar_item) {
int content_string_id, button_string_id; int content_string_id, button_string_id;
...@@ -754,6 +765,7 @@ bool ProfileMenuView::AddSyncErrorViewIfNeeded( ...@@ -754,6 +765,7 @@ bool ProfileMenuView::AddSyncErrorViewIfNeeded(
return true; return true;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::AddPreDiceSyncErrorView( void ProfileMenuView::AddPreDiceSyncErrorView(
const AvatarMenu::Item& avatar_item, const AvatarMenu::Item& avatar_item,
sync_ui_util::AvatarSyncErrorType error, sync_ui_util::AvatarSyncErrorType error,
...@@ -780,6 +792,7 @@ void ProfileMenuView::AddPreDiceSyncErrorView( ...@@ -780,6 +792,7 @@ void ProfileMenuView::AddPreDiceSyncErrorView(
} }
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::AddDiceSyncErrorView( void ProfileMenuView::AddDiceSyncErrorView(
const AvatarMenu::Item& avatar_item, const AvatarMenu::Item& avatar_item,
sync_ui_util::AvatarSyncErrorType error, sync_ui_util::AvatarSyncErrorType error,
...@@ -832,6 +845,7 @@ void ProfileMenuView::AddDiceSyncErrorView( ...@@ -832,6 +845,7 @@ void ProfileMenuView::AddDiceSyncErrorView(
} }
} }
// TODO(crbug.com/1021587): Incorporate into ProfileMenuRevamp.
void ProfileMenuView::AddSyncPausedReasonCookiesClearedOnExit() { void ProfileMenuView::AddSyncPausedReasonCookiesClearedOnExit() {
base::string16 link_text = l10n_util::GetStringUTF16( base::string16 link_text = l10n_util::GetStringUTF16(
IDS_SYNC_PAUSED_REASON_CLEAR_COOKIES_ON_EXIT_LINK_TEXT); IDS_SYNC_PAUSED_REASON_CLEAR_COOKIES_ON_EXIT_LINK_TEXT);
...@@ -845,6 +859,7 @@ void ProfileMenuView::AddSyncPausedReasonCookiesClearedOnExit() { ...@@ -845,6 +859,7 @@ void ProfileMenuView::AddSyncPausedReasonCookiesClearedOnExit() {
base::Unretained(this))); base::Unretained(this)));
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuView::AddCurrentProfileView( void ProfileMenuView::AddCurrentProfileView(
const AvatarMenu::Item& avatar_item, const AvatarMenu::Item& avatar_item,
bool is_guest) { bool is_guest) {
......
...@@ -28,6 +28,7 @@ class Browser; ...@@ -28,6 +28,7 @@ class Browser;
// This bubble view is displayed when the user clicks on the avatar button. // This bubble view is displayed when the user clicks on the avatar button.
// It displays a list of profiles and allows users to switch between profiles. // It displays a list of profiles and allows users to switch between profiles.
// TODO(crbug.com/993752): Remove AvatarMenuObserver after ProfileMenuRevamp.
class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
public: public:
ProfileMenuView(views::Button* anchor_button, ProfileMenuView(views::Button* anchor_button,
...@@ -41,6 +42,7 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -41,6 +42,7 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
private: private:
friend class ProfileMenuViewExtensionsTest; friend class ProfileMenuViewExtensionsTest;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// ProfileMenuViewBase: // ProfileMenuViewBase:
void FocusButtonOnKeyboardOpen() override; void FocusButtonOnKeyboardOpen() override;
...@@ -55,11 +57,9 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -55,11 +57,9 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
void OnAddressesButtonClicked(); void OnAddressesButtonClicked();
void OnGuestProfileButtonClicked(); void OnGuestProfileButtonClicked();
void OnManageProfilesButtonClicked(); void OnManageProfilesButtonClicked();
void OnLockButtonClicked();
void OnExitProfileButtonClicked(); void OnExitProfileButtonClicked();
void OnSyncSettingsButtonClicked(); void OnSyncSettingsButtonClicked();
void OnSyncErrorButtonClicked(sync_ui_util::AvatarSyncErrorType error); void OnSyncErrorButtonClicked(sync_ui_util::AvatarSyncErrorType error);
void OnCurrentProfileCardClicked();
void OnSigninButtonClicked(); void OnSigninButtonClicked();
void OnSigninAccountButtonClicked(AccountInfo account); void OnSigninAccountButtonClicked(AccountInfo account);
void OnSignoutButtonClicked(); void OnSignoutButtonClicked();
...@@ -68,6 +68,11 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -68,6 +68,11 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
void OnAddNewProfileButtonClicked(); void OnAddNewProfileButtonClicked();
void OnEditProfileButtonClicked(); void OnEditProfileButtonClicked();
// TODO(crbug.com/1021587): Remove methods after ProfileMenuRevamp.
void OnLockButtonClicked();
void OnCurrentProfileCardClicked();
// TODO(crbug.com/993752): Remove after ProfileMenuRevamp.
// AvatarMenuObserver: // AvatarMenuObserver:
void OnAvatarMenuChanged(AvatarMenu* avatar_menu) override; void OnAvatarMenuChanged(AvatarMenu* avatar_menu) override;
...@@ -87,9 +92,11 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -87,9 +92,11 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
void BuildSelectableProfiles(); void BuildSelectableProfiles();
void BuildProfileManagementFeatureButtons(); void BuildProfileManagementFeatureButtons();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds the profile chooser view. // Adds the profile chooser view.
void AddProfileMenuView(AvatarMenu* avatar_menu); void AddProfileMenuView(AvatarMenu* avatar_menu);
// TODO(crbug.com/1021587): Remove methods below after ProfileMenuRevamp.
// Adds the main profile card for the profile |avatar_item|. |is_guest| is // Adds the main profile card for the profile |avatar_item|. |is_guest| is
// used to determine whether to show any Sign in/Sign out/Manage accounts // used to determine whether to show any Sign in/Sign out/Manage accounts
// links. // links.
...@@ -101,14 +108,17 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -101,14 +108,17 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
void AddAutofillHomeView(); void AddAutofillHomeView();
void AddManageGoogleAccountButton(); void AddManageGoogleAccountButton();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds the DICE UI view to sign in and turn on sync. It includes an // Adds the DICE UI view to sign in and turn on sync. It includes an
// illustration, a promo and a button. // illustration, a promo and a button.
void AddDiceSigninView(); void AddDiceSigninView();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds a header for signin and sync error surfacing for the user menu. // Adds a header for signin and sync error surfacing for the user menu.
// Returns true if header is created. // Returns true if header is created.
bool AddSyncErrorViewIfNeeded(const AvatarMenu::Item& avatar_item); bool AddSyncErrorViewIfNeeded(const AvatarMenu::Item& avatar_item);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds a view showing a sync error and an error button, when dice is not // Adds a view showing a sync error and an error button, when dice is not
// enabled. // enabled.
void AddPreDiceSyncErrorView(const AvatarMenu::Item& avatar_item, void AddPreDiceSyncErrorView(const AvatarMenu::Item& avatar_item,
...@@ -116,42 +126,53 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver { ...@@ -116,42 +126,53 @@ class ProfileMenuView : public ProfileMenuViewBase, public AvatarMenuObserver {
int button_string_id, int button_string_id,
int content_string_id); int content_string_id);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds a view showing the profile associated with |avatar_item| and an error // Adds a view showing the profile associated with |avatar_item| and an error
// button below, when dice is enabled. // button below, when dice is enabled.
void AddDiceSyncErrorView(const AvatarMenu::Item& avatar_item, void AddDiceSyncErrorView(const AvatarMenu::Item& avatar_item,
sync_ui_util::AvatarSyncErrorType error, sync_ui_util::AvatarSyncErrorType error,
int button_string_id); int button_string_id);
// TODO(crbug.com/1021587): Add to new profile menu.
// Add a view showing that the reason for the sync paused is in the cookie // Add a view showing that the reason for the sync paused is in the cookie
// settings setup. On click, will direct to the cookie settings page. // settings setup. On click, will direct to the cookie settings page.
void AddSyncPausedReasonCookiesClearedOnExit(); void AddSyncPausedReasonCookiesClearedOnExit();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds a promo for signin, if dice is not enabled. // Adds a promo for signin, if dice is not enabled.
void AddPreDiceSigninPromo(); void AddPreDiceSigninPromo();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Adds a promo for signin, if dice is enabled. // Adds a promo for signin, if dice is enabled.
void AddDiceSigninPromo(); void AddDiceSigninPromo();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Clean-up done after an action was performed in the ProfileChooser. // Clean-up done after an action was performed in the ProfileChooser.
void PostActionPerformed(ProfileMetrics::ProfileDesktopMenu action_performed); void PostActionPerformed(ProfileMetrics::ProfileDesktopMenu action_performed);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Methods to keep track of the number of times the Dice sign-in promo has // Methods to keep track of the number of times the Dice sign-in promo has
// been shown. // been shown.
int GetDiceSigninPromoShowCount() const; int GetDiceSigninPromoShowCount() const;
void IncrementDiceSigninPromoShowCount(); void IncrementDiceSigninPromoShowCount();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
std::unique_ptr<AvatarMenu> avatar_menu_; std::unique_ptr<AvatarMenu> avatar_menu_;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Button pointers used in tests. // Button pointers used in tests.
views::Button* first_profile_button_ = nullptr; views::Button* first_profile_button_ = nullptr;
views::Button* lock_button_ = nullptr; views::Button* lock_button_ = nullptr;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// The current access point of sign in. // The current access point of sign in.
const signin_metrics::AccessPoint access_point_; const signin_metrics::AccessPoint access_point_;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Dice accounts used in the sync promo. // Dice accounts used in the sync promo.
std::vector<AccountInfo> dice_accounts_; std::vector<AccountInfo> dice_accounts_;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
const bool dice_enabled_; const bool dice_enabled_;
DISALLOW_COPY_AND_ASSIGN(ProfileMenuView); DISALLOW_COPY_AND_ASSIGN(ProfileMenuView);
......
...@@ -162,6 +162,7 @@ std::unique_ptr<views::Button> CreateCircularImageButton( ...@@ -162,6 +162,7 @@ std::unique_ptr<views::Button> CreateCircularImageButton(
} // namespace } // namespace
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// MenuItems-------------------------------------------------------------------- // MenuItems--------------------------------------------------------------------
ProfileMenuViewBase::MenuItems::MenuItems() ProfileMenuViewBase::MenuItems::MenuItems()
...@@ -246,6 +247,7 @@ ProfileMenuViewBase::~ProfileMenuViewBase() { ...@@ -246,6 +247,7 @@ ProfileMenuViewBase::~ProfileMenuViewBase() {
// Items stored for menu generation are removed after menu is finalized, hence // Items stored for menu generation are removed after menu is finalized, hence
// it's not expected to have while destroying the object. // it's not expected to have while destroying the object.
DCHECK(g_profile_bubble_ != this); DCHECK(g_profile_bubble_ != this);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
DCHECK(menu_item_groups_.empty()); DCHECK(menu_item_groups_.empty());
} }
...@@ -569,6 +571,7 @@ bool ProfileMenuViewBase::HandleContextMenu( ...@@ -569,6 +571,7 @@ bool ProfileMenuViewBase::HandleContextMenu(
void ProfileMenuViewBase::Init() { void ProfileMenuViewBase::Init() {
Reset(); Reset();
BuildMenu(); BuildMenu();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
if (!base::FeatureList::IsEnabled(features::kProfileMenuRevamp)) if (!base::FeatureList::IsEnabled(features::kProfileMenuRevamp))
RepopulateViewFromMenuItems(); RepopulateViewFromMenuItems();
} }
...@@ -617,6 +620,7 @@ int ProfileMenuViewBase::GetMaxHeight() const { ...@@ -617,6 +620,7 @@ int ProfileMenuViewBase::GetMaxHeight() const {
} }
void ProfileMenuViewBase::Reset() { void ProfileMenuViewBase::Reset() {
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
if (!base::FeatureList::IsEnabled(features::kProfileMenuRevamp)) { if (!base::FeatureList::IsEnabled(features::kProfileMenuRevamp)) {
menu_item_groups_.clear(); menu_item_groups_.clear();
return; return;
...@@ -683,6 +687,7 @@ void ProfileMenuViewBase::Reset() { ...@@ -683,6 +687,7 @@ void ProfileMenuViewBase::Reset() {
layout->AddView(std::move(scroll_view)); layout->AddView(std::move(scroll_view));
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
int ProfileMenuViewBase::GetMarginSize(GroupMarginSize margin_size) const { int ProfileMenuViewBase::GetMarginSize(GroupMarginSize margin_size) const {
switch (margin_size) { switch (margin_size) {
case kNone: case kNone:
...@@ -699,6 +704,7 @@ int ProfileMenuViewBase::GetMarginSize(GroupMarginSize margin_size) const { ...@@ -699,6 +704,7 @@ int ProfileMenuViewBase::GetMarginSize(GroupMarginSize margin_size) const {
} }
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuViewBase::AddMenuGroup(bool add_separator) { void ProfileMenuViewBase::AddMenuGroup(bool add_separator) {
if (add_separator && !menu_item_groups_.empty()) { if (add_separator && !menu_item_groups_.empty()) {
DCHECK(!menu_item_groups_.back().items.empty()); DCHECK(!menu_item_groups_.back().items.empty());
...@@ -708,6 +714,7 @@ void ProfileMenuViewBase::AddMenuGroup(bool add_separator) { ...@@ -708,6 +714,7 @@ void ProfileMenuViewBase::AddMenuGroup(bool add_separator) {
menu_item_groups_.emplace_back(); menu_item_groups_.emplace_back();
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuViewBase::AddMenuItemInternal(std::unique_ptr<views::View> view, void ProfileMenuViewBase::AddMenuItemInternal(std::unique_ptr<views::View> view,
MenuItems::ItemType item_type) { MenuItems::ItemType item_type) {
DCHECK(!menu_item_groups_.empty()); DCHECK(!menu_item_groups_.empty());
...@@ -724,6 +731,7 @@ void ProfileMenuViewBase::AddMenuItemInternal(std::unique_ptr<views::View> view, ...@@ -724,6 +731,7 @@ void ProfileMenuViewBase::AddMenuItemInternal(std::unique_ptr<views::View> view,
} }
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
views::Button* ProfileMenuViewBase::CreateAndAddTitleCard( views::Button* ProfileMenuViewBase::CreateAndAddTitleCard(
std::unique_ptr<views::View> icon_view, std::unique_ptr<views::View> icon_view,
const base::string16& title, const base::string16& title,
...@@ -739,6 +747,7 @@ views::Button* ProfileMenuViewBase::CreateAndAddTitleCard( ...@@ -739,6 +747,7 @@ views::Button* ProfileMenuViewBase::CreateAndAddTitleCard(
return button_ptr; return button_ptr;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
views::Button* ProfileMenuViewBase::CreateAndAddButton( views::Button* ProfileMenuViewBase::CreateAndAddButton(
const gfx::ImageSkia& icon, const gfx::ImageSkia& icon,
const base::string16& title, const base::string16& title,
...@@ -751,6 +760,7 @@ views::Button* ProfileMenuViewBase::CreateAndAddButton( ...@@ -751,6 +760,7 @@ views::Button* ProfileMenuViewBase::CreateAndAddButton(
return pointer; return pointer;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
views::Button* ProfileMenuViewBase::CreateAndAddBlueButton( views::Button* ProfileMenuViewBase::CreateAndAddBlueButton(
const base::string16& text, const base::string16& text,
bool md_style, bool md_style,
...@@ -772,6 +782,7 @@ views::Button* ProfileMenuViewBase::CreateAndAddBlueButton( ...@@ -772,6 +782,7 @@ views::Button* ProfileMenuViewBase::CreateAndAddBlueButton(
return pointer; return pointer;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
DiceSigninButtonView* ProfileMenuViewBase::CreateAndAddDiceSigninButton( DiceSigninButtonView* ProfileMenuViewBase::CreateAndAddDiceSigninButton(
AccountInfo* account_info, AccountInfo* account_info,
...@@ -796,6 +807,7 @@ DiceSigninButtonView* ProfileMenuViewBase::CreateAndAddDiceSigninButton( ...@@ -796,6 +807,7 @@ DiceSigninButtonView* ProfileMenuViewBase::CreateAndAddDiceSigninButton(
} }
#endif #endif
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
views::Label* ProfileMenuViewBase::CreateAndAddLabel(const base::string16& text, views::Label* ProfileMenuViewBase::CreateAndAddLabel(const base::string16& text,
int text_context) { int text_context) {
std::unique_ptr<views::Label> label = std::unique_ptr<views::Label> label =
...@@ -816,6 +828,7 @@ views::Label* ProfileMenuViewBase::CreateAndAddLabel(const base::string16& text, ...@@ -816,6 +828,7 @@ views::Label* ProfileMenuViewBase::CreateAndAddLabel(const base::string16& text,
return pointer; return pointer;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
views::StyledLabel* ProfileMenuViewBase::CreateAndAddLabelWithLink( views::StyledLabel* ProfileMenuViewBase::CreateAndAddLabelWithLink(
const base::string16& text, const base::string16& text,
gfx::Range link_range, gfx::Range link_range,
...@@ -831,6 +844,7 @@ views::StyledLabel* ProfileMenuViewBase::CreateAndAddLabelWithLink( ...@@ -831,6 +844,7 @@ views::StyledLabel* ProfileMenuViewBase::CreateAndAddLabelWithLink(
return pointer; return pointer;
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuViewBase::AddViewItem(std::unique_ptr<views::View> view) { void ProfileMenuViewBase::AddViewItem(std::unique_ptr<views::View> view) {
// Add margins. // Add margins.
std::unique_ptr<views::View> margined_view = std::make_unique<views::View>(); std::unique_ptr<views::View> margined_view = std::make_unique<views::View>();
...@@ -847,6 +861,7 @@ void ProfileMenuViewBase::RegisterClickAction(views::View* clickable_view, ...@@ -847,6 +861,7 @@ void ProfileMenuViewBase::RegisterClickAction(views::View* clickable_view,
click_actions_[clickable_view] = std::move(action); click_actions_[clickable_view] = std::move(action);
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void ProfileMenuViewBase::RepopulateViewFromMenuItems() { void ProfileMenuViewBase::RepopulateViewFromMenuItems() {
RemoveAllChildViews(true); RemoveAllChildViews(true);
...@@ -941,11 +956,13 @@ void ProfileMenuViewBase::RepopulateViewFromMenuItems() { ...@@ -941,11 +956,13 @@ void ProfileMenuViewBase::RepopulateViewFromMenuItems() {
} }
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
gfx::ImageSkia ProfileMenuViewBase::CreateVectorIcon( gfx::ImageSkia ProfileMenuViewBase::CreateVectorIcon(
const gfx::VectorIcon& icon) { const gfx::VectorIcon& icon) {
return gfx::CreateVectorIcon(icon, kIconSize, GetDefaultIconColor()); return gfx::CreateVectorIcon(icon, kIconSize, GetDefaultIconColor());
} }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
int ProfileMenuViewBase::GetDefaultIconSize() { int ProfileMenuViewBase::GetDefaultIconSize() {
return kIconSize; return kIconSize;
} }
...@@ -32,6 +32,7 @@ class Label; ...@@ -32,6 +32,7 @@ class Label;
} // namespace views } // namespace views
struct AccountInfo; struct AccountInfo;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
class DiceSigninButtonView; class DiceSigninButtonView;
// This class provides the UI for different menus that are created by user // This class provides the UI for different menus that are created by user
...@@ -67,6 +68,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -67,6 +68,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
kMaxValue = kEditProfileButton, kMaxValue = kEditProfileButton,
}; };
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// MenuItems struct keeps the menu items and meta data for a group of items in // MenuItems struct keeps the menu items and meta data for a group of items in
// a menu. It takes the ownership of views and passes it to the menu when menu // a menu. It takes the ownership of views and passes it to the menu when menu
// is constructed. // is constructed.
...@@ -93,6 +95,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -93,6 +95,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
DISALLOW_COPY_AND_ASSIGN(MenuItems); DISALLOW_COPY_AND_ASSIGN(MenuItems);
}; };
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
enum GroupMarginSize { kNone, kTiny, kSmall, kLarge }; enum GroupMarginSize { kNone, kTiny, kSmall, kLarge };
// Shows the bubble if one is not already showing. This allows us to easily // Shows the bubble if one is not already showing. This allows us to easily
...@@ -158,10 +161,12 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -158,10 +161,12 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
// Should be called inside each button/link action. // Should be called inside each button/link action.
void RecordClick(ActionableItem item); void RecordClick(ActionableItem item);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Initializes a new group of menu items. A separator is added before them if // Initializes a new group of menu items. A separator is added before them if
// |add_separator| is true. // |add_separator| is true.
void AddMenuGroup(bool add_separator = true); void AddMenuGroup(bool add_separator = true);
// TODO(crbug.com/1021587): Remove methods below after ProfileMenuRevamp.
// The following functions add different menu items to the latest menu group. // The following functions add different menu items to the latest menu group.
// They pass the ownership of the generated item to |menu_item_groups_| and // They pass the ownership of the generated item to |menu_item_groups_| and
// return a raw pointer to the object. The ownership is transferred to the // return a raw pointer to the object. The ownership is transferred to the
...@@ -200,16 +205,20 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -200,16 +205,20 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
views::Button* anchor_button() const { return anchor_button_; } views::Button* anchor_button() const { return anchor_button_; }
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
gfx::ImageSkia CreateVectorIcon(const gfx::VectorIcon& icon); gfx::ImageSkia CreateVectorIcon(const gfx::VectorIcon& icon);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
int GetDefaultIconSize(); int GetDefaultIconSize();
private: private:
friend class ProfileMenuViewExtensionsTest; friend class ProfileMenuViewExtensionsTest;
void Reset(); void Reset();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void RepopulateViewFromMenuItems(); void RepopulateViewFromMenuItems();
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Requests focus for a button when opened by keyboard. // Requests focus for a button when opened by keyboard.
virtual void FocusButtonOnKeyboardOpen() {} virtual void FocusButtonOnKeyboardOpen() {}
...@@ -240,14 +249,17 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -240,14 +249,17 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
void RegisterClickAction(views::View* clickable_view, void RegisterClickAction(views::View* clickable_view,
base::RepeatingClosure action); base::RepeatingClosure action);
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// Returns the size of different margin types. // Returns the size of different margin types.
int GetMarginSize(GroupMarginSize margin_size) const; int GetMarginSize(GroupMarginSize margin_size) const;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
void AddMenuItemInternal(std::unique_ptr<views::View> view, void AddMenuItemInternal(std::unique_ptr<views::View> view,
MenuItems::ItemType item_type); MenuItems::ItemType item_type);
Browser* const browser_; Browser* const browser_;
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// ProfileMenuViewBase takes ownership of all menu_items and passes it to the // ProfileMenuViewBase takes ownership of all menu_items and passes it to the
// underlying view when it is created. // underlying view when it is created.
std::vector<MenuItems> menu_item_groups_; std::vector<MenuItems> menu_item_groups_;
......
...@@ -155,6 +155,7 @@ Profile* SetupProfilesForLock(Profile* signed_in) { ...@@ -155,6 +155,7 @@ Profile* SetupProfilesForLock(Profile* signed_in) {
} // namespace } // namespace
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
class ProfileMenuViewExtensionsTest class ProfileMenuViewExtensionsTest
: public SupportsTestDialog<extensions::ExtensionBrowserTest> { : public SupportsTestDialog<extensions::ExtensionBrowserTest> {
public: public:
...@@ -266,6 +267,7 @@ class ProfileMenuViewExtensionsTest ...@@ -266,6 +267,7 @@ class ProfileMenuViewExtensionsTest
DISALLOW_COPY_AND_ASSIGN(ProfileMenuViewExtensionsTest); DISALLOW_COPY_AND_ASSIGN(ProfileMenuViewExtensionsTest);
}; };
// TODO(crbug.com/1021587): Remove after ProfileMenuRevamp.
// TODO(crbug.com/932818): Remove this class after // TODO(crbug.com/932818): Remove this class after
// |kAutofillEnableToolbarStatusChip| is cleaned up. Otherwise we need it // |kAutofillEnableToolbarStatusChip| is cleaned up. Otherwise we need it
// because the toolbar is init-ed before each test is set up. Thus need to // because the toolbar is init-ed before each test is set up. Thus need to
......
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