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

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

Issue 1907363004: (Merge to M-51) Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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/user/tray_user.cc ('k') | ash/test/shelf_test_api.h » ('j') | 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 66924528a6f7cc3a8a0f3f5d8de3ffe159ee6e7a..1f2e461c95c567976f03fc0f74621244719ffb6d 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -8,6 +8,7 @@
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
+#include "ash/shelf/shelf_util.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -218,25 +219,14 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) {
message_center_tray_.get(),
true);
- int max_height = 0;
+ // Assume the status area and bubble bottoms are aligned when vertical.
aura::Window* status_area_window = status_area_widget()->GetNativeView();
- switch (GetShelfLayoutManager()->GetAlignment()) {
- case SHELF_ALIGNMENT_BOTTOM: {
- gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds();
- max_height = shelf_bounds.y();
- 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;
- }
- }
+ const int max_height =
+ IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment())
+ ? GetShelfLayoutManager()->GetIdealBounds().y()
+ : status_area_window->GetBoundsInRootWindow().bottom();
- message_center_bubble->SetMaxHeight(std::max(0,
- max_height - kTraySpacing));
+ message_center_bubble->SetMaxHeight(std::max(0, max_height - kTraySpacing));
if (show_settings)
message_center_bubble->SetSettingsVisible();
message_center_bubble_.reset(
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | ash/test/shelf_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698