| 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/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 kNoUnreadIconSize, kWebNotificationColorNoUnread); | 315 kNoUnreadIconSize, kWebNotificationColorNoUnread); |
| 316 const gfx::Size bell_icon_size = | 316 const gfx::Size bell_icon_size = |
| 317 md_shelf ? kTrayItemInnerIconSize : kTrayItemInnerBellIconSizeNonMd; | 317 md_shelf ? kTrayItemInnerIconSize : kTrayItemInnerBellIconSizeNonMd; |
| 318 bell_icon_.reset(new WebNotificationImage(bell_image, bell_icon_size, | 318 bell_icon_.reset(new WebNotificationImage(bell_image, bell_icon_size, |
| 319 animation_container_.get(), this)); | 319 animation_container_.get(), this)); |
| 320 tray_container()->AddChildView(bell_icon_.get()); | 320 tray_container()->AddChildView(bell_icon_.get()); |
| 321 | 321 |
| 322 counter_.reset(new WebNotificationLabel(animation_container_.get(), this)); | 322 counter_.reset(new WebNotificationLabel(animation_container_.get(), this)); |
| 323 tray_container()->AddChildView(counter_.get()); | 323 tray_container()->AddChildView(counter_.get()); |
| 324 | 324 |
| 325 SetContentsBackground(); | 325 SetContentsBackground(true); |
| 326 message_center_tray_.reset(new message_center::MessageCenterTray( | 326 message_center_tray_.reset(new message_center::MessageCenterTray( |
| 327 this, message_center::MessageCenter::Get())); | 327 this, message_center::MessageCenter::Get())); |
| 328 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); | 328 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); |
| 329 popup_collection_.reset(new message_center::MessagePopupCollection( | 329 popup_collection_.reset(new message_center::MessagePopupCollection( |
| 330 message_center(), message_center_tray_.get(), | 330 message_center(), message_center_tray_.get(), |
| 331 popup_alignment_delegate_.get())); | 331 popup_alignment_delegate_.get())); |
| 332 const display::Display& display = | 332 const display::Display& display = |
| 333 status_area_window_->GetDisplayNearestWindow(); | 333 status_area_window_->GetDisplayNearestWindow(); |
| 334 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), | 334 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), |
| 335 display); | 335 display); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 message_center_bubble->SetMaxHeight( | 374 message_center_bubble->SetMaxHeight( |
| 375 std::max(0, max_height - GetTrayConstant(TRAY_SPACING))); | 375 std::max(0, max_height - GetTrayConstant(TRAY_SPACING))); |
| 376 if (show_settings) | 376 if (show_settings) |
| 377 message_center_bubble->SetSettingsVisible(); | 377 message_center_bubble->SetSettingsVisible(); |
| 378 message_center_bubble_.reset( | 378 message_center_bubble_.reset( |
| 379 new WebNotificationBubbleWrapper(this, message_center_bubble)); | 379 new WebNotificationBubbleWrapper(this, message_center_bubble)); |
| 380 | 380 |
| 381 system_tray_->SetHideNotifications(true); | 381 system_tray_->SetHideNotifications(true); |
| 382 shelf()->UpdateAutoHideState(); | 382 shelf()->UpdateAutoHideState(); |
| 383 SetDrawBackgroundAsActive(true); | 383 SetIsActive(true); |
| 384 return true; | 384 return true; |
| 385 } | 385 } |
| 386 | 386 |
| 387 bool WebNotificationTray::ShowMessageCenter() { | 387 bool WebNotificationTray::ShowMessageCenter() { |
| 388 return ShowMessageCenterInternal(false /* show_settings */); | 388 return ShowMessageCenterInternal(false /* show_settings */); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void WebNotificationTray::HideMessageCenter() { | 391 void WebNotificationTray::HideMessageCenter() { |
| 392 if (!message_center_bubble()) | 392 if (!message_center_bubble()) |
| 393 return; | 393 return; |
| 394 SetDrawBackgroundAsActive(false); | 394 SetIsActive(false); |
| 395 message_center_bubble_.reset(); | 395 message_center_bubble_.reset(); |
| 396 should_block_shelf_auto_hide_ = false; | 396 should_block_shelf_auto_hide_ = false; |
| 397 show_message_center_on_unlock_ = false; | 397 show_message_center_on_unlock_ = false; |
| 398 system_tray_->SetHideNotifications(false); | 398 system_tray_->SetHideNotifications(false); |
| 399 shelf()->UpdateAutoHideState(); | 399 shelf()->UpdateAutoHideState(); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void WebNotificationTray::SetTrayBubbleHeight(int height) { | 402 void WebNotificationTray::SetTrayBubbleHeight(int height) { |
| 403 popup_alignment_delegate_->SetTrayBubbleHeight(height); | 403 popup_alignment_delegate_->SetTrayBubbleHeight(height); |
| 404 } | 404 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 | 667 |
| 668 message_center::MessageCenterBubble* | 668 message_center::MessageCenterBubble* |
| 669 WebNotificationTray::GetMessageCenterBubbleForTest() { | 669 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 670 if (!message_center_bubble()) | 670 if (!message_center_bubble()) |
| 671 return nullptr; | 671 return nullptr; |
| 672 return static_cast<message_center::MessageCenterBubble*>( | 672 return static_cast<message_center::MessageCenterBubble*>( |
| 673 message_center_bubble()->bubble()); | 673 message_center_bubble()->bubble()); |
| 674 } | 674 } |
| 675 | 675 |
| 676 } // namespace ash | 676 } // namespace ash |
| OLD | NEW |