| Index: ash/common/system/tray/tray_item_more.cc
|
| diff --git a/ash/common/system/tray/tray_item_more.cc b/ash/common/system/tray/tray_item_more.cc
|
| index 681c08b58edc621c2402787500963048d5788abd..4638c410bf375c4071f61e02a483a6d8ff1297b9 100644
|
| --- a/ash/common/system/tray/tray_item_more.cc
|
| +++ b/ash/common/system/tray/tray_item_more.cc
|
| @@ -5,10 +5,11 @@
|
| #include "ash/common/system/tray/tray_item_more.h"
|
|
|
| #include "ash/common/material_design/material_design_controller.h"
|
| -#include "ash/common/system/tray/fixed_sized_image_view.h"
|
| #include "ash/common/system/tray/system_tray_item.h"
|
| #include "ash/common/system/tray/tray_constants.h"
|
| #include "ash/common/system/tray/tray_popup_item_style.h"
|
| +#include "ash/common/system/tray/tray_popup_utils.h"
|
| +#include "ash/common/system/tray/tri_view.h"
|
| #include "ash/resources/vector_icons/vector_icons.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "grit/ash_resources.h"
|
| @@ -19,6 +20,7 @@
|
| #include "ui/views/controls/image_view.h"
|
| #include "ui/views/controls/label.h"
|
| #include "ui/views/layout/box_layout.h"
|
| +#include "ui/views/layout/fill_layout.h"
|
|
|
| namespace ash {
|
|
|
| @@ -28,27 +30,27 @@ TrayItemMore::TrayItemMore(SystemTrayItem* owner, bool show_more)
|
| icon_(nullptr),
|
| label_(nullptr),
|
| more_(nullptr) {
|
| - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
|
| - kTrayPopupPaddingHorizontal, 0,
|
| - kTrayPopupPaddingBetweenItems));
|
| + TriView* tri_view = TrayPopupUtils::CreateDefaultRowView();
|
| + AddChildView(tri_view);
|
| + SetLayoutManager(new views::FillLayout);
|
|
|
| - icon_ = new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT));
|
| - AddChildView(icon_);
|
| + icon_ = TrayPopupUtils::CreateMainImageView();
|
| + tri_view->AddView(TriView::Container::START, icon_);
|
|
|
| - label_ = new views::Label;
|
| - label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
|
| - AddChildView(label_);
|
| + label_ = TrayPopupUtils::CreateDefaultLabel();
|
| + tri_view->AddView(TriView::Container::CENTER, label_);
|
|
|
| if (show_more) {
|
| - more_ = new views::ImageView;
|
| - more_->EnableCanvasFlippingForRTLUI(true);
|
| + more_ = TrayPopupUtils::CreateMoreImageView();
|
| if (!MaterialDesignController::IsSystemTrayMenuMaterial()) {
|
| // The icon doesn't change in non-md.
|
| more_->SetImage(ui::ResourceBundle::GetSharedInstance()
|
| .GetImageNamed(IDR_AURA_UBER_TRAY_MORE)
|
| .ToImageSkia());
|
| }
|
| - AddChildView(more_);
|
| + tri_view->AddView(TriView::Container::END, more_);
|
| + } else {
|
| + tri_view->SetContainerVisible(TriView::Container::END, false);
|
| }
|
| }
|
|
|
| @@ -94,29 +96,6 @@ bool TrayItemMore::PerformAction(const ui::Event& event) {
|
| return true;
|
| }
|
|
|
| -void TrayItemMore::Layout() {
|
| - // Let the box-layout do the layout first. Then move the '>' arrow to right
|
| - // align.
|
| - views::View::Layout();
|
| -
|
| - if (!show_more_)
|
| - return;
|
| -
|
| - // Make sure the chevron always has the full size.
|
| - gfx::Size size = more_->GetPreferredSize();
|
| - gfx::Rect bounds(size);
|
| - bounds.set_x(width() - size.width() - kTrayPopupPaddingBetweenItems);
|
| - bounds.set_y((height() - size.height()) / 2);
|
| - more_->SetBoundsRect(bounds);
|
| -
|
| - // Adjust the label's bounds in case it got cut off by |more_|.
|
| - if (label_->bounds().Intersects(more_->bounds())) {
|
| - gfx::Rect bounds = label_->bounds();
|
| - bounds.set_width(more_->x() - kTrayPopupPaddingBetweenItems - label_->x());
|
| - label_->SetBoundsRect(bounds);
|
| - }
|
| -}
|
| -
|
| void TrayItemMore::GetAccessibleState(ui::AXViewState* state) {
|
| ActionableView::GetAccessibleState(state);
|
| if (!accessible_name_.empty())
|
|
|