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

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: 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 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));
« 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