Index: ash/system/tray/system_tray_bubble.cc |
diff --git a/ash/system/tray/system_tray_bubble.cc b/ash/system/tray/system_tray_bubble.cc |
index aff271958f1d185ee9e67f755f413551037aeeb3..e567ff60939f4f6288a54ba67a985fe88557e6c4 100644 |
--- a/ash/system/tray/system_tray_bubble.cc |
+++ b/ash/system/tray/system_tray_bubble.cc |
@@ -16,7 +16,7 @@ |
#include "ui/compositor/layer_animation_observer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/gfx/canvas.h" |
-#include "ui/views/layout/box_layout.h" |
+#include "ui/views/layout/fill_layout.h" |
#include "ui/views/view.h" |
#include "ui/views/widget/widget.h" |
@@ -43,10 +43,7 @@ class TrayPopupItemContainer : public views::View { |
: hover_(false), |
change_background_(change_background) { |
set_notify_enter_exit_on_child(true); |
- views::BoxLayout* layout = new views::BoxLayout( |
- views::BoxLayout::kVertical, 0, 0, 0); |
- layout->set_spread_blank_space(true); |
- SetLayoutManager(layout); |
+ SetLayoutManager(new views::FillLayout); |
SetPaintToLayer(view->layer() != NULL); |
if (view->layer()) |
SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); |
@@ -317,13 +314,14 @@ bool SystemTrayBubble::ShouldShowLauncher() const { |
} |
void SystemTrayBubble::CreateItemViews(user::LoginStatus login_status) { |
+ const int bubble_width = bubble_view_->GetPreferredSize().width(); |
for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); |
it != items_.end(); |
++it) { |
views::View* view = NULL; |
switch (bubble_type_) { |
case BUBBLE_TYPE_DEFAULT: |
- view = (*it)->CreateDefaultView(login_status); |
+ view = (*it)->CreateDefaultView(login_status, bubble_width); |
break; |
case BUBBLE_TYPE_DETAILED: |
view = (*it)->CreateDetailedView(login_status); |
@@ -335,6 +333,10 @@ void SystemTrayBubble::CreateItemViews(user::LoginStatus login_status) { |
if (view) { |
bubble_view_->AddChildView(new TrayPopupItemContainer( |
view, tray_->shelf_alignment(), bubble_type_ == BUBBLE_TYPE_DEFAULT)); |
+ if (bubble_type_ == BUBBLE_TYPE_DEFAULT && |
+ (*it)->GuaranteeDefaultViewPreferredSize(login_status)) { |
+ bubble_view_->SetMinWidth(view->GetPreferredSize().width()); |
+ } |
} |
} |
} |