OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_layout_manager_observer.h" | 10 #include "ash/shelf/shelf_layout_manager_observer.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 true); | 219 true); |
220 | 220 |
221 int max_height = 0; | 221 int max_height = 0; |
222 aura::Window* status_area_window = status_area_widget()->GetNativeView(); | 222 aura::Window* status_area_window = status_area_widget()->GetNativeView(); |
223 switch (GetShelfLayoutManager()->GetAlignment()) { | 223 switch (GetShelfLayoutManager()->GetAlignment()) { |
224 case SHELF_ALIGNMENT_BOTTOM: { | 224 case SHELF_ALIGNMENT_BOTTOM: { |
225 gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds(); | 225 gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds(); |
226 max_height = shelf_bounds.y(); | 226 max_height = shelf_bounds.y(); |
227 break; | 227 break; |
228 } | 228 } |
229 case SHELF_ALIGNMENT_TOP: { | |
230 aura::Window* root = status_area_window->GetRootWindow(); | |
231 max_height = | |
232 root->bounds().height() - status_area_window->bounds().height(); | |
233 break; | |
234 } | |
235 case SHELF_ALIGNMENT_LEFT: | 229 case SHELF_ALIGNMENT_LEFT: |
236 case SHELF_ALIGNMENT_RIGHT: { | 230 case SHELF_ALIGNMENT_RIGHT: { |
237 // Assume that the bottom line of the status area widget and the bubble | 231 // Assume that the bottom line of the status area widget and the bubble |
238 // are aligned. | 232 // are aligned. |
239 max_height = status_area_window->GetBoundsInRootWindow().bottom(); | 233 max_height = status_area_window->GetBoundsInRootWindow().bottom(); |
240 break; | 234 break; |
241 } | 235 } |
242 default: | |
243 NOTREACHED(); | |
244 } | 236 } |
245 | 237 |
246 message_center_bubble->SetMaxHeight(std::max(0, | 238 message_center_bubble->SetMaxHeight(std::max(0, |
247 max_height - kTraySpacing)); | 239 max_height - kTraySpacing)); |
248 if (show_settings) | 240 if (show_settings) |
249 message_center_bubble->SetSettingsVisible(); | 241 message_center_bubble->SetSettingsVisible(); |
250 message_center_bubble_.reset( | 242 message_center_bubble_.reset( |
251 new WebNotificationBubbleWrapper(this, message_center_bubble)); | 243 new WebNotificationBubbleWrapper(this, message_center_bubble)); |
252 | 244 |
253 status_area_widget()->SetHideSystemNotifications(true); | 245 status_area_widget()->SetHideSystemNotifications(true); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 488 |
497 message_center::MessageCenterBubble* | 489 message_center::MessageCenterBubble* |
498 WebNotificationTray::GetMessageCenterBubbleForTest() { | 490 WebNotificationTray::GetMessageCenterBubbleForTest() { |
499 if (!message_center_bubble()) | 491 if (!message_center_bubble()) |
500 return NULL; | 492 return NULL; |
501 return static_cast<message_center::MessageCenterBubble*>( | 493 return static_cast<message_center::MessageCenterBubble*>( |
502 message_center_bubble()->bubble()); | 494 message_center_bubble()->bubble()); |
503 } | 495 } |
504 | 496 |
505 } // namespace ash | 497 } // namespace ash |
OLD | NEW |