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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 void WebNotificationTray::HidePopups() { | 297 void WebNotificationTray::HidePopups() { |
298 DCHECK(popup_collection_.get()); | 298 DCHECK(popup_collection_.get()); |
299 popup_collection_->MarkAllPopupsShown(); | 299 popup_collection_->MarkAllPopupsShown(); |
300 } | 300 } |
301 | 301 |
302 // Private methods. | 302 // Private methods. |
303 | 303 |
304 bool WebNotificationTray::ShouldShowMessageCenter() { | 304 bool WebNotificationTray::ShouldShowMessageCenter() { |
305 return !(status_area_widget()->system_tray() && | 305 return status_area_widget()->login_status() != user::LOGGED_IN_LOCKED && |
306 status_area_widget()->system_tray()->HasNotificationBubble()); | 306 !(status_area_widget()->system_tray() && |
| 307 status_area_widget()->system_tray()->HasNotificationBubble()); |
307 } | 308 } |
308 | 309 |
309 bool WebNotificationTray::ShouldBlockShelfAutoHide() const { | 310 bool WebNotificationTray::ShouldBlockShelfAutoHide() const { |
310 return should_block_shelf_auto_hide_; | 311 return should_block_shelf_auto_hide_; |
311 } | 312 } |
312 | 313 |
313 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { | 314 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { |
314 return (message_center_bubble() && | 315 return (message_center_bubble() && |
315 message_center_bubble()->bubble()->IsVisible()); | 316 message_center_bubble()->bubble()->IsVisible()); |
316 } | 317 } |
317 | 318 |
318 bool WebNotificationTray::IsMouseInNotificationBubble() const { | 319 bool WebNotificationTray::IsMouseInNotificationBubble() const { |
319 return false; | 320 return false; |
320 } | 321 } |
321 | 322 |
322 void WebNotificationTray::ShowMessageCenterBubble() { | 323 void WebNotificationTray::ShowMessageCenterBubble() { |
323 if (!IsMessageCenterBubbleVisible()) | 324 if (!IsMessageCenterBubbleVisible()) |
324 message_center_tray_->ShowMessageCenterBubble(); | 325 message_center_tray_->ShowMessageCenterBubble(); |
325 } | 326 } |
326 | 327 |
327 void WebNotificationTray::UpdateAfterLoginStatusChange( | 328 void WebNotificationTray::UpdateAfterLoginStatusChange( |
328 user::LoginStatus login_status) { | 329 user::LoginStatus login_status) { |
329 message_center()->SetLockedState(login_status == user::LOGGED_IN_LOCKED); | |
330 OnMessageCenterTrayChanged(); | 330 OnMessageCenterTrayChanged(); |
331 } | 331 } |
332 | 332 |
333 void WebNotificationTray::SetShelfAlignment(wm::ShelfAlignment alignment) { | 333 void WebNotificationTray::SetShelfAlignment(wm::ShelfAlignment alignment) { |
334 if (alignment == shelf_alignment()) | 334 if (alignment == shelf_alignment()) |
335 return; | 335 return; |
336 TrayBackgroundView::SetShelfAlignment(alignment); | 336 TrayBackgroundView::SetShelfAlignment(alignment); |
337 tray_container()->SetBorder(views::Border::NullBorder()); | 337 tray_container()->SetBorder(views::Border::NullBorder()); |
338 // Destroy any existing bubble so that it will be rebuilt correctly. | 338 // Destroy any existing bubble so that it will be rebuilt correctly. |
339 message_center_tray_->HideMessageCenterBubble(); | 339 message_center_tray_->HideMessageCenterBubble(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 402 } |
403 return ShowMessageCenterInternal(true /* show_settings */); | 403 return ShowMessageCenterInternal(true /* show_settings */); |
404 } | 404 } |
405 | 405 |
406 bool WebNotificationTray::IsContextMenuEnabled() const { | 406 bool WebNotificationTray::IsContextMenuEnabled() const { |
407 user::LoginStatus login_status = status_area_widget()->login_status(); | 407 user::LoginStatus login_status = status_area_widget()->login_status(); |
408 bool userAddingRunning = ash::Shell::GetInstance() | 408 bool userAddingRunning = ash::Shell::GetInstance() |
409 ->session_state_delegate() | 409 ->session_state_delegate() |
410 ->IsInSecondaryLoginScreen(); | 410 ->IsInSecondaryLoginScreen(); |
411 | 411 |
412 return login_status != user::LOGGED_IN_NONE && !userAddingRunning; | 412 return login_status != user::LOGGED_IN_NONE |
| 413 && login_status != user::LOGGED_IN_LOCKED && !userAddingRunning; |
413 } | 414 } |
414 | 415 |
415 message_center::MessageCenterTray* WebNotificationTray::GetMessageCenterTray() { | 416 message_center::MessageCenterTray* WebNotificationTray::GetMessageCenterTray() { |
416 return message_center_tray_.get(); | 417 return message_center_tray_.get(); |
417 } | 418 } |
418 | 419 |
419 bool WebNotificationTray::IsCommandIdChecked(int command_id) const { | 420 bool WebNotificationTray::IsCommandIdChecked(int command_id) const { |
420 if (command_id != kToggleQuietMode) | 421 if (command_id != kToggleQuietMode) |
421 return false; | 422 return false; |
422 return message_center()->IsQuietMode(); | 423 return message_center()->IsQuietMode(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 button_->SetUnreadCount(message_center->UnreadNotificationCount()); | 471 button_->SetUnreadCount(message_center->UnreadNotificationCount()); |
471 if (IsMessageCenterBubbleVisible()) | 472 if (IsMessageCenterBubbleVisible()) |
472 button_->SetState(views::CustomButton::STATE_PRESSED); | 473 button_->SetState(views::CustomButton::STATE_PRESSED); |
473 else | 474 else |
474 button_->SetState(views::CustomButton::STATE_NORMAL); | 475 button_->SetState(views::CustomButton::STATE_NORMAL); |
475 bool userAddingRunning = ash::Shell::GetInstance() | 476 bool userAddingRunning = ash::Shell::GetInstance() |
476 ->session_state_delegate() | 477 ->session_state_delegate() |
477 ->IsInSecondaryLoginScreen(); | 478 ->IsInSecondaryLoginScreen(); |
478 | 479 |
479 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE) && | 480 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE) && |
| 481 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED) && |
480 !userAddingRunning); | 482 !userAddingRunning); |
481 Layout(); | 483 Layout(); |
482 SchedulePaint(); | 484 SchedulePaint(); |
483 } | 485 } |
484 | 486 |
485 void WebNotificationTray::ClickedOutsideBubble() { | 487 void WebNotificationTray::ClickedOutsideBubble() { |
486 // Only hide the message center | 488 // Only hide the message center |
487 if (!message_center_bubble()) | 489 if (!message_center_bubble()) |
488 return; | 490 return; |
489 | 491 |
(...skipping 12 matching lines...) Expand all Loading... |
502 | 504 |
503 message_center::MessageCenterBubble* | 505 message_center::MessageCenterBubble* |
504 WebNotificationTray::GetMessageCenterBubbleForTest() { | 506 WebNotificationTray::GetMessageCenterBubbleForTest() { |
505 if (!message_center_bubble()) | 507 if (!message_center_bubble()) |
506 return NULL; | 508 return NULL; |
507 return static_cast<message_center::MessageCenterBubble*>( | 509 return static_cast<message_center::MessageCenterBubble*>( |
508 message_center_bubble()->bubble()); | 510 message_center_bubble()->bubble()); |
509 } | 511 } |
510 | 512 |
511 } // namespace ash | 513 } // namespace ash |
OLD | NEW |