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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 if (message_center_bubble()) { | 386 if (message_center_bubble()) { |
387 static_cast<message_center::MessageCenterBubble*>( | 387 static_cast<message_center::MessageCenterBubble*>( |
388 message_center_bubble()->bubble())->SetSettingsVisible(); | 388 message_center_bubble()->bubble())->SetSettingsVisible(); |
389 return true; | 389 return true; |
390 } | 390 } |
391 return ShowMessageCenterInternal(true /* show_settings */); | 391 return ShowMessageCenterInternal(true /* show_settings */); |
392 } | 392 } |
393 | 393 |
394 bool WebNotificationTray::IsContextMenuEnabled() const { | 394 bool WebNotificationTray::IsContextMenuEnabled() const { |
395 user::LoginStatus login_status = status_area_widget()->login_status(); | 395 user::LoginStatus login_status = status_area_widget()->login_status(); |
| 396 bool userAddingRunning = ash::Shell::GetInstance() |
| 397 ->session_state_delegate() |
| 398 ->IsInSecondaryLoginScreen(); |
| 399 |
396 return login_status != user::LOGGED_IN_NONE | 400 return login_status != user::LOGGED_IN_NONE |
397 && login_status != user::LOGGED_IN_LOCKED; | 401 && login_status != user::LOGGED_IN_LOCKED && !userAddingRunning; |
398 } | 402 } |
399 | 403 |
400 message_center::MessageCenterTray* WebNotificationTray::GetMessageCenterTray() { | 404 message_center::MessageCenterTray* WebNotificationTray::GetMessageCenterTray() { |
401 return message_center_tray_.get(); | 405 return message_center_tray_.get(); |
402 } | 406 } |
403 | 407 |
404 bool WebNotificationTray::IsCommandIdChecked(int command_id) const { | 408 bool WebNotificationTray::IsCommandIdChecked(int command_id) const { |
405 if (command_id != kToggleQuietMode) | 409 if (command_id != kToggleQuietMode) |
406 return false; | 410 return false; |
407 return message_center()->IsQuietMode(); | 411 return message_center()->IsQuietMode(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 return; | 454 return; |
451 should_update_tray_content_ = false; | 455 should_update_tray_content_ = false; |
452 | 456 |
453 message_center::MessageCenter* message_center = | 457 message_center::MessageCenter* message_center = |
454 message_center_tray_->message_center(); | 458 message_center_tray_->message_center(); |
455 button_->SetUnreadCount(message_center->UnreadNotificationCount()); | 459 button_->SetUnreadCount(message_center->UnreadNotificationCount()); |
456 if (IsMessageCenterBubbleVisible()) | 460 if (IsMessageCenterBubbleVisible()) |
457 button_->SetState(views::CustomButton::STATE_PRESSED); | 461 button_->SetState(views::CustomButton::STATE_PRESSED); |
458 else | 462 else |
459 button_->SetState(views::CustomButton::STATE_NORMAL); | 463 button_->SetState(views::CustomButton::STATE_NORMAL); |
| 464 bool userAddingRunning = ash::Shell::GetInstance() |
| 465 ->session_state_delegate() |
| 466 ->IsInSecondaryLoginScreen(); |
| 467 |
460 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE) && | 468 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE) && |
461 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED) && | 469 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED) && |
462 (message_center->NotificationCount() > 0)); | 470 !userAddingRunning && (message_center->NotificationCount() > 0)); |
463 Layout(); | 471 Layout(); |
464 SchedulePaint(); | 472 SchedulePaint(); |
465 } | 473 } |
466 | 474 |
467 bool WebNotificationTray::ClickedOutsideBubble() { | 475 bool WebNotificationTray::ClickedOutsideBubble() { |
468 // Only hide the message center | 476 // Only hide the message center |
469 if (!message_center_bubble()) | 477 if (!message_center_bubble()) |
470 return false; | 478 return false; |
471 | 479 |
472 message_center_tray_->HideMessageCenterBubble(); | 480 message_center_tray_->HideMessageCenterBubble(); |
(...skipping 12 matching lines...) Expand all Loading... |
485 | 493 |
486 message_center::MessageCenterBubble* | 494 message_center::MessageCenterBubble* |
487 WebNotificationTray::GetMessageCenterBubbleForTest() { | 495 WebNotificationTray::GetMessageCenterBubbleForTest() { |
488 if (!message_center_bubble()) | 496 if (!message_center_bubble()) |
489 return NULL; | 497 return NULL; |
490 return static_cast<message_center::MessageCenterBubble*>( | 498 return static_cast<message_center::MessageCenterBubble*>( |
491 message_center_bubble()->bubble()); | 499 message_center_bubble()->bubble()); |
492 } | 500 } |
493 | 501 |
494 } // namespace ash | 502 } // namespace ash |
OLD | NEW |