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/common/shelf/wm_shelf_util.h" |
8 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
9 #include "ash/common/wm/shelf/wm_shelf_util.h" | |
10 #include "ash/common/wm_lookup.h" | 10 #include "ash/common/wm_lookup.h" |
11 #include "ash/common/wm_root_window_controller.h" | 11 #include "ash/common/wm_root_window_controller.h" |
12 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
13 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
14 #include "ash/shelf/shelf_layout_manager.h" | 14 #include "ash/shelf/shelf_layout_manager.h" |
15 #include "ash/shelf/shelf_layout_manager_observer.h" | 15 #include "ash/shelf/shelf_layout_manager_observer.h" |
16 #include "ash/shelf/shelf_util.h" | 16 #include "ash/shelf/shelf_util.h" |
17 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
19 #include "ash/system/status_area_widget.h" | 19 #include "ash/system/status_area_widget.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 return false; | 242 return false; |
243 | 243 |
244 should_block_shelf_auto_hide_ = true; | 244 should_block_shelf_auto_hide_ = true; |
245 message_center::MessageCenterBubble* message_center_bubble = | 245 message_center::MessageCenterBubble* message_center_bubble = |
246 new message_center::MessageCenterBubble( | 246 new message_center::MessageCenterBubble( |
247 message_center(), | 247 message_center(), |
248 message_center_tray_.get(), | 248 message_center_tray_.get(), |
249 true); | 249 true); |
250 | 250 |
251 int max_height; | 251 int max_height; |
252 if (wm::IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment())) { | 252 if (IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment())) { |
253 max_height = GetShelfLayoutManager()->GetIdealBounds().y(); | 253 max_height = GetShelfLayoutManager()->GetIdealBounds().y(); |
254 } else { | 254 } else { |
255 // Assume the status area and bubble bottoms are aligned when vertical. | 255 // Assume the status area and bubble bottoms are aligned when vertical. |
256 WmWindow* status_area_window = | 256 WmWindow* status_area_window = |
257 WmLookup::Get()->GetWindowForWidget(status_area_widget()); | 257 WmLookup::Get()->GetWindowForWidget(status_area_widget()); |
258 gfx::Rect bounds_in_root = | 258 gfx::Rect bounds_in_root = |
259 status_area_window->GetRootWindow()->ConvertRectFromScreen( | 259 status_area_window->GetRootWindow()->ConvertRectFromScreen( |
260 status_area_window->GetBoundsInScreen()); | 260 status_area_window->GetBoundsInScreen()); |
261 max_height = bounds_in_root.bottom(); | 261 max_height = bounds_in_root.bottom(); |
262 } | 262 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 if (!IsMessageCenterBubbleVisible()) | 334 if (!IsMessageCenterBubbleVisible()) |
335 message_center_tray_->ShowMessageCenterBubble(); | 335 message_center_tray_->ShowMessageCenterBubble(); |
336 } | 336 } |
337 | 337 |
338 void WebNotificationTray::UpdateAfterLoginStatusChange( | 338 void WebNotificationTray::UpdateAfterLoginStatusChange( |
339 user::LoginStatus login_status) { | 339 user::LoginStatus login_status) { |
340 message_center()->SetLockedState(login_status == user::LOGGED_IN_LOCKED); | 340 message_center()->SetLockedState(login_status == user::LOGGED_IN_LOCKED); |
341 OnMessageCenterTrayChanged(); | 341 OnMessageCenterTrayChanged(); |
342 } | 342 } |
343 | 343 |
344 void WebNotificationTray::SetShelfAlignment(wm::ShelfAlignment alignment) { | 344 void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) { |
345 if (alignment == shelf_alignment()) | 345 if (alignment == shelf_alignment()) |
346 return; | 346 return; |
347 TrayBackgroundView::SetShelfAlignment(alignment); | 347 TrayBackgroundView::SetShelfAlignment(alignment); |
348 tray_container()->SetBorder(views::Border::NullBorder()); | 348 tray_container()->SetBorder(views::Border::NullBorder()); |
349 // Destroy any existing bubble so that it will be rebuilt correctly. | 349 // Destroy any existing bubble so that it will be rebuilt correctly. |
350 message_center_tray_->HideMessageCenterBubble(); | 350 message_center_tray_->HideMessageCenterBubble(); |
351 message_center_tray_->HidePopupBubble(); | 351 message_center_tray_->HidePopupBubble(); |
352 } | 352 } |
353 | 353 |
354 void WebNotificationTray::AnchorUpdated() { | 354 void WebNotificationTray::AnchorUpdated() { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 message_center::MessageCenterBubble* | 514 message_center::MessageCenterBubble* |
515 WebNotificationTray::GetMessageCenterBubbleForTest() { | 515 WebNotificationTray::GetMessageCenterBubbleForTest() { |
516 if (!message_center_bubble()) | 516 if (!message_center_bubble()) |
517 return NULL; | 517 return NULL; |
518 return static_cast<message_center::MessageCenterBubble*>( | 518 return static_cast<message_center::MessageCenterBubble*>( |
519 message_center_bubble()->bubble()); | 519 message_center_bubble()->bubble()); |
520 } | 520 } |
521 | 521 |
522 } // namespace ash | 522 } // namespace ash |
OLD | NEW |