| Index: ash/common/system/tray/system_tray.cc
|
| diff --git a/ash/common/system/tray/system_tray.cc b/ash/common/system/tray/system_tray.cc
|
| index eaaab2e9d7a34667ceedfa54c8004b50ea531819..865d10e3277b44d6d6ef4d4cb1bae8db3248702f 100644
|
| --- a/ash/common/system/tray/system_tray.cc
|
| +++ b/ash/common/system/tray/system_tray.cc
|
| @@ -75,6 +75,39 @@ using views::TrayBubbleView;
|
|
|
| namespace ash {
|
|
|
| +namespace {
|
| +
|
| +// A tray item that just reserves space in the tray.
|
| +class PaddingTrayItem : public SystemTrayItem {
|
| + public:
|
| + PaddingTrayItem() : SystemTrayItem(nullptr, UMA_NOT_RECORDED) {}
|
| + ~PaddingTrayItem() override {}
|
| +
|
| + // SystemTrayItem:
|
| + views::View* CreateTrayView(LoginStatus status) override {
|
| + return new PaddingView();
|
| + }
|
| +
|
| + private:
|
| + class PaddingView : public views::View {
|
| + public:
|
| + PaddingView() {}
|
| + ~PaddingView() override {}
|
| +
|
| + private:
|
| + gfx::Size GetPreferredSize() const override {
|
| + return gfx::Size(GetTrayConstant(TRAY_IMAGE_ITEM_PADDING),
|
| + GetTrayConstant(TRAY_IMAGE_ITEM_PADDING));
|
| + }
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PaddingView);
|
| + };
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PaddingTrayItem);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| // The minimum width of the system tray menu.
|
| const int kMinimumSystemTrayMenuWidth = 300;
|
| const int kMinimumSystemTrayMenuWidthMd = 332;
|
| @@ -184,8 +217,6 @@ SystemTray::SystemTray(WmShelf* wm_shelf)
|
| screen_capture_tray_item_(nullptr),
|
| screen_share_tray_item_(nullptr) {
|
| SetContentsBackground();
|
| - if (MaterialDesignController::IsSystemTrayMenuMaterial())
|
| - tray_container()->SetMargin(GetTrayConstant(TRAY_IMAGE_ITEM_PADDING), 0);
|
| }
|
|
|
| SystemTray::~SystemTray() {
|
| @@ -223,6 +254,11 @@ void SystemTray::CreateItems(SystemTrayDelegate* delegate) {
|
| for (int i = 0; i < maximum_user_profiles; i++)
|
| AddTrayItem(new TrayUser(this, i));
|
|
|
| + // Crucially, this trailing padding has to be inside the user item(s).
|
| + // Otherwise it could be a main axis margin on the tray's box layout.
|
| + if (MaterialDesignController::IsSystemTrayMenuMaterial())
|
| + AddTrayItem(new PaddingTrayItem());
|
| +
|
| if (maximum_user_profiles > 1) {
|
| // Add a special double line separator between users and the rest of the
|
| // menu if more than one user is logged in.
|
| @@ -282,6 +318,9 @@ void SystemTray::CreateItems(SystemTrayDelegate* delegate) {
|
| if (!use_material_design)
|
| AddTrayItem(tray_date_);
|
| #endif
|
| + // Leading padding.
|
| + if (MaterialDesignController::IsSystemTrayMenuMaterial())
|
| + AddTrayItem(new PaddingTrayItem());
|
| }
|
|
|
| void SystemTray::AddTrayItem(SystemTrayItem* item) {
|
|
|