Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1892)

Unified Diff: ash/system/web_notification/web_notification_tray.cc

Issue 12248012: Makes a gap at the top boundary of message center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: std::max Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7ea81aabd9159a6519b0b1980aa7303078efa568..bc06e9a3d081259d7e4bb2390867a80d0c3d25c5 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));
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698