diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-13 21:24:29 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-13 21:24:29 +0000 |
commit | e605e66a5cf98d4e31d5066f88ce08409bf90566 (patch) | |
tree | a3499142e4de7079db987b76bfb37ef3083b5bb3 /ash/system | |
parent | cfa24e624aabefef186b8582f18bbee02b8d5ffe (diff) | |
download | chromium_src-e605e66a5cf98d4e31d5066f88ce08409bf90566.zip chromium_src-e605e66a5cf98d4e31d5066f88ce08409bf90566.tar.gz chromium_src-e605e66a5cf98d4e31d5066f88ce08409bf90566.tar.bz2 |
Makes a gap at the top boundary of message center.
BUG=174097
TEST=manually checked on goobuntu
Review URL: https://codereview.chromium.org/12248012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r-- | ash/system/status_area_widget_delegate.cc | 7 | ||||
-rw-r--r-- | ash/system/tray/tray_constants.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/tray_constants.h | 2 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray.cc | 33 |
4 files changed, 30 insertions, 14 deletions
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc index 3e599a9..35f1329 100644 --- a/ash/system/status_area_widget_delegate.cc +++ b/ash/system/status_area_widget_delegate.cc @@ -8,6 +8,7 @@ #include "ash/focus_cycler.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/system/tray/tray_constants.h" #include "base/utf_string_conversions.h" #include "ui/aura/root_window.h" #include "ui/base/resource/resource_bundle.h" @@ -17,12 +18,6 @@ #include "ui/views/layout/grid_layout.h" #include "ui/views/widget/widget.h" -namespace { - -int kTraySpacing = 8; - -} // namespace - namespace ash { namespace internal { diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc index 05867e8..5070185 100644 --- a/ash/system/tray/tray_constants.cc +++ b/ash/system/tray/tray_constants.cc @@ -62,4 +62,6 @@ const int kNotificationIconWidth = 40; const int kTrayNotificationContentsWidth = kTrayPopupMinWidth - (kNotificationIconWidth + kTrayPopupPaddingHorizontal) * 2; +const int kTraySpacing = 8; + } // namespace ash diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h index 72a955a..c14db9d 100644 --- a/ash/system/tray/tray_constants.h +++ b/ash/system/tray/tray_constants.h @@ -60,6 +60,8 @@ extern const int kTrayPopupMaxWidth; extern const int kNotificationIconWidth; extern const int kTrayNotificationContentsWidth; +extern const int kTraySpacing; + } // namespace ash #endif // ASH_SYSTEM_TRAY_TRAY_CONSTANTS_H_ diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 7ea81aa..bc06e9a 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,30 @@ 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(); } + max_height = std::max(0, max_height - kTraySpacing); message_center_bubble->SetMaxHeight(max_height); message_center_bubble_.reset( new internal::WebNotificationBubbleWrapper(this, message_center_bubble)); |