| 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/common/system/web_notification/web_notification_tray.h" | 5 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 bell_icon_.reset(new WebNotificationImage(bell_image, | 319 bell_icon_.reset(new WebNotificationImage(bell_image, |
| 320 kTrayItemInnerBellIconSize, | 320 kTrayItemInnerBellIconSize, |
| 321 animation_container_.get(), this)); | 321 animation_container_.get(), this)); |
| 322 tray_container()->AddChildView(bell_icon_.get()); | 322 tray_container()->AddChildView(bell_icon_.get()); |
| 323 | 323 |
| 324 counter_.reset(new WebNotificationLabel(animation_container_.get(), this)); | 324 counter_.reset(new WebNotificationLabel(animation_container_.get(), this)); |
| 325 tray_container()->AddChildView(counter_.get()); | 325 tray_container()->AddChildView(counter_.get()); |
| 326 | 326 |
| 327 SetContentsBackground(); | 327 SetContentsBackground(); |
| 328 tray_container()->SetBorder(views::Border::NullBorder()); | |
| 329 message_center_tray_.reset(new message_center::MessageCenterTray( | 328 message_center_tray_.reset(new message_center::MessageCenterTray( |
| 330 this, message_center::MessageCenter::Get())); | 329 this, message_center::MessageCenter::Get())); |
| 331 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); | 330 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); |
| 332 popup_collection_.reset(new message_center::MessagePopupCollection( | 331 popup_collection_.reset(new message_center::MessagePopupCollection( |
| 333 message_center(), message_center_tray_.get(), | 332 message_center(), message_center_tray_.get(), |
| 334 popup_alignment_delegate_.get())); | 333 popup_alignment_delegate_.get())); |
| 335 const display::Display& display = | 334 const display::Display& display = |
| 336 status_area_window_->GetDisplayNearestWindow(); | 335 status_area_window_->GetDisplayNearestWindow(); |
| 337 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), | 336 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), |
| 338 display); | 337 display); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 void WebNotificationTray::UpdateAfterLoginStatusChange( | 449 void WebNotificationTray::UpdateAfterLoginStatusChange( |
| 451 LoginStatus login_status) { | 450 LoginStatus login_status) { |
| 452 message_center()->SetLockedState(login_status == LoginStatus::LOCKED); | 451 message_center()->SetLockedState(login_status == LoginStatus::LOCKED); |
| 453 OnMessageCenterTrayChanged(); | 452 OnMessageCenterTrayChanged(); |
| 454 } | 453 } |
| 455 | 454 |
| 456 void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) { | 455 void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) { |
| 457 if (alignment == shelf_alignment()) | 456 if (alignment == shelf_alignment()) |
| 458 return; | 457 return; |
| 459 TrayBackgroundView::SetShelfAlignment(alignment); | 458 TrayBackgroundView::SetShelfAlignment(alignment); |
| 460 tray_container()->SetBorder(views::Border::NullBorder()); | |
| 461 // Destroy any existing bubble so that it will be rebuilt correctly. | 459 // Destroy any existing bubble so that it will be rebuilt correctly. |
| 462 message_center_tray_->HideMessageCenterBubble(); | 460 message_center_tray_->HideMessageCenterBubble(); |
| 463 message_center_tray_->HidePopupBubble(); | 461 message_center_tray_->HidePopupBubble(); |
| 464 } | 462 } |
| 465 | 463 |
| 466 void WebNotificationTray::AnchorUpdated() { | 464 void WebNotificationTray::AnchorUpdated() { |
| 467 if (message_center_bubble()) { | 465 if (message_center_bubble()) { |
| 468 message_center_bubble()->bubble_view()->UpdateBubble(); | 466 message_center_bubble()->bubble_view()->UpdateBubble(); |
| 469 UpdateBubbleViewArrow(message_center_bubble()->bubble_view()); | 467 UpdateBubbleViewArrow(message_center_bubble()->bubble_view()); |
| 470 } | 468 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 676 |
| 679 message_center::MessageCenterBubble* | 677 message_center::MessageCenterBubble* |
| 680 WebNotificationTray::GetMessageCenterBubbleForTest() { | 678 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 681 if (!message_center_bubble()) | 679 if (!message_center_bubble()) |
| 682 return NULL; | 680 return NULL; |
| 683 return static_cast<message_center::MessageCenterBubble*>( | 681 return static_cast<message_center::MessageCenterBubble*>( |
| 684 message_center_bubble()->bubble()); | 682 message_center_bubble()->bubble()); |
| 685 } | 683 } |
| 686 | 684 |
| 687 } // namespace ash | 685 } // namespace ash |
| OLD | NEW |