Commit 5413c1f3 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Remove special case for menu width

The menu width no longer depends on the Dice state.
The Dice menu width is always used from now on.

Reasons:
 - The pre-Dice menu works perfectly with the Dice menu width.
 - pre-Dice users are a very small percentage of users.
 - pre-Dice users will soon be migrated.

Bug: 966388
Change-Id: I0721a0f7d2f56891ad9d01c99bce77505b3b9779
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1751842
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686433}
parent d3564aae
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/hover_button.h" #include "chrome/browser/ui/views/hover_button.h"
...@@ -37,8 +36,7 @@ ProfileMenuViewBase* g_profile_bubble_ = nullptr; ...@@ -37,8 +36,7 @@ ProfileMenuViewBase* g_profile_bubble_ = nullptr;
// Helpers -------------------------------------------------------------------- // Helpers --------------------------------------------------------------------
constexpr int kFixedMenuWidthPreDice = 240; constexpr int kMenuWidth = 288;
constexpr int kFixedMenuWidthDice = 288;
constexpr int kIconSize = 16; constexpr int kIconSize = 16;
// If the bubble is too large to fit on the screen, it still needs to be at // If the bubble is too large to fit on the screen, it still needs to be at
...@@ -116,7 +114,6 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button, ...@@ -116,7 +114,6 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button,
Browser* browser) Browser* browser)
: BubbleDialogDelegateView(anchor_button, views::BubbleBorder::TOP_RIGHT), : BubbleDialogDelegateView(anchor_button, views::BubbleBorder::TOP_RIGHT),
browser_(browser), browser_(browser),
menu_width_(0),
anchor_button_(anchor_button), anchor_button_(anchor_button),
close_bubble_helper_(this, browser) { close_bubble_helper_(this, browser) {
DCHECK(!g_profile_bubble_); DCHECK(!g_profile_bubble_);
...@@ -130,10 +127,6 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button, ...@@ -130,10 +127,6 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button,
EnableUpDownKeyboardAccelerators(); EnableUpDownKeyboardAccelerators();
GetViewAccessibility().OverrideRole(ax::mojom::Role::kMenu); GetViewAccessibility().OverrideRole(ax::mojom::Role::kMenu);
bool dice_enabled = AccountConsistencyModeManager::IsDiceEnabledForProfile(
browser->profile());
menu_width_ = dice_enabled ? kFixedMenuWidthDice : kFixedMenuWidthPreDice;
} }
ProfileMenuViewBase::~ProfileMenuViewBase() { ProfileMenuViewBase::~ProfileMenuViewBase() {
...@@ -312,7 +305,7 @@ views::Label* ProfileMenuViewBase::CreateAndAddLabel(const base::string16& text, ...@@ -312,7 +305,7 @@ views::Label* ProfileMenuViewBase::CreateAndAddLabel(const base::string16& text,
std::make_unique<views::Label>(text, text_context); std::make_unique<views::Label>(text, text_context);
label->SetMultiLine(true); label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetMaximumWidth(menu_width_ - 2 * kMenuEdgeMargin); label->SetMaximumWidth(kMenuWidth - 2 * kMenuEdgeMargin);
views::Label* pointer = label.get(); views::Label* pointer = label.get();
// Add margins. // Add margins.
...@@ -420,7 +413,7 @@ void ProfileMenuViewBase::RepopulateViewFromMenuItems() { ...@@ -420,7 +413,7 @@ void ProfileMenuViewBase::RepopulateViewFromMenuItems() {
views::ColumnSet* columns = layout->AddColumnSet(0); views::ColumnSet* columns = layout->AddColumnSet(0);
columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
views::GridLayout::kFixedSize, views::GridLayout::FIXED, views::GridLayout::kFixedSize, views::GridLayout::FIXED,
menu_width_, menu_width_); kMenuWidth, kMenuWidth);
layout->StartRow(1.0, 0); layout->StartRow(1.0, 0);
layout->AddView(std::move(scroll_view)); layout->AddView(std::move(scroll_view));
if (GetBubbleFrameView()) { if (GetBubbleFrameView()) {
......
...@@ -166,8 +166,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -166,8 +166,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
Browser* const browser_; Browser* const browser_;
int menu_width_;
// 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_;
......
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