Chromium Code Reviews| Index: ash/system/web_notification/web_notification_tray.cc |
| diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc |
| index 3db837c0ecd7c91ff4ec12866680ccf4c51e5191..a52653cf08ce799bcb82e7ec2047215a8018e54f 100644 |
| --- a/ash/system/web_notification/web_notification_tray.cc |
| +++ b/ash/system/web_notification/web_notification_tray.cc |
| @@ -10,9 +10,11 @@ |
| #include "ash/system/status_area_widget.h" |
| #include "ash/system/tray/tray_background_view.h" |
| #include "ash/system/tray/tray_bubble_wrapper.h" |
| +#include "ash/system/tray/tray_constants.h" |
| #include "ash/wm/shelf_layout_manager.h" |
| #include "grit/ash_resources.h" |
| #include "grit/ash_strings.h" |
| +#include "ui/aura/root_window.h" |
| #include "ui/aura/window.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/resource/resource_bundle.h" |
| @@ -119,15 +121,31 @@ bool WebNotificationTray::ShowMessageCenter() { |
| // TODO(mukai): move this to WebNotificationBubbleWrapper if it's safe |
| // to set the height of the popup. |
| int max_height = 0; |
| - if (GetShelfLayoutManager()->GetAlignment() == SHELF_ALIGNMENT_BOTTOM) { |
| - gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds(); |
| - max_height = shelf_bounds.y(); |
| - } else { |
| - // Assume that the bottom line of the status area widget and the bubble are |
| - // aligned. |
| - aura::Window* status_area_window = status_area_widget()->GetNativeWindow(); |
| - max_height = status_area_window->GetBoundsInRootWindow().bottom(); |
| + aura::Window* status_area_window = status_area_widget()->GetNativeWindow(); |
| + switch (GetShelfLayoutManager()->GetAlignment()) { |
| + case SHELF_ALIGNMENT_BOTTOM: { |
| + gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds(); |
| + max_height = shelf_bounds.y(); |
| + break; |
| + } |
| + case SHELF_ALIGNMENT_TOP: { |
| + aura::RootWindow* root = status_area_window->GetRootWindow(); |
| + max_height = |
| + root->bounds().height() - status_area_window->bounds().height(); |
| + break; |
| + } |
| + case SHELF_ALIGNMENT_LEFT: |
| + case SHELF_ALIGNMENT_RIGHT: { |
| + // Assume that the bottom line of the status area widget and the bubble |
| + // are aligned. |
| + max_height = status_area_window->GetBoundsInRootWindow().bottom(); |
| + break; |
| + } |
| + default: |
| + NOTREACHED(); |
| } |
| + if (max_height > kTraySpacing) |
| + max_height -= kTraySpacing; |
|
stevenjb
2013/02/13 18:54:45
We should just subtract kTraySpacing when appropri
Jun Mukai
2013/02/13 19:42:27
used std::max(0, ...)
|
| message_center_bubble->SetMaxHeight(max_height); |
| message_center_bubble_.reset( |
| new internal::WebNotificationBubbleWrapper(this, message_center_bubble)); |