| 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/session/session_controller.h" | 7 #include "ash/common/session/session_controller.h" |
| 8 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/shelf/wm_shelf_util.h" | 10 #include "ash/common/shelf/wm_shelf_util.h" |
| 11 #include "ash/common/system/status_area_widget.h" | 11 #include "ash/common/system/status_area_widget.h" |
| 12 #include "ash/common/system/tray/system_tray.h" | 12 #include "ash/common/system/tray/system_tray.h" |
| 13 #include "ash/common/system/tray/system_tray_delegate.h" | 13 #include "ash/common/system/tray/system_tray_delegate.h" |
| 14 #include "ash/common/system/tray/tray_bubble_wrapper.h" | 14 #include "ash/common/system/tray/tray_bubble_wrapper.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_utils.h" | 16 #include "ash/common/system/tray/tray_utils.h" |
| 17 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" | 17 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" |
| 18 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
| 20 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
| 21 #include "ash/resources/vector_icons/vector_icons.h" | 21 #include "ash/resources/vector_icons/vector_icons.h" |
| 22 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 23 #include "ash/shell.h" |
| 23 #include "ash/strings/grit/ash_strings.h" | 24 #include "ash/strings/grit/ash_strings.h" |
| 24 #include "base/auto_reset.h" | 25 #include "base/auto_reset.h" |
| 25 #include "base/i18n/number_formatting.h" | 26 #include "base/i18n/number_formatting.h" |
| 26 #include "base/i18n/rtl.h" | 27 #include "base/i18n/rtl.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 28 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/display/display.h" | 31 #include "ui/display/display.h" |
| 31 #include "ui/display/screen.h" | 32 #include "ui/display/screen.h" |
| 32 #include "ui/gfx/paint_vector_icon.h" | 33 #include "ui/gfx/paint_vector_icon.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 390 } |
| 390 | 391 |
| 391 void WebNotificationTray::HidePopups() { | 392 void WebNotificationTray::HidePopups() { |
| 392 DCHECK(popup_collection_.get()); | 393 DCHECK(popup_collection_.get()); |
| 393 popup_collection_->MarkAllPopupsShown(); | 394 popup_collection_->MarkAllPopupsShown(); |
| 394 } | 395 } |
| 395 | 396 |
| 396 // Private methods. | 397 // Private methods. |
| 397 | 398 |
| 398 bool WebNotificationTray::ShouldShowMessageCenter() { | 399 bool WebNotificationTray::ShouldShowMessageCenter() { |
| 399 return WmShell::Get()->system_tray_delegate()->ShouldShowNotificationTray(); | 400 return Shell::Get()->system_tray_delegate()->ShouldShowNotificationTray(); |
| 400 } | 401 } |
| 401 | 402 |
| 402 bool WebNotificationTray::ShouldBlockShelfAutoHide() const { | 403 bool WebNotificationTray::ShouldBlockShelfAutoHide() const { |
| 403 return should_block_shelf_auto_hide_; | 404 return should_block_shelf_auto_hide_; |
| 404 } | 405 } |
| 405 | 406 |
| 406 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { | 407 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { |
| 407 return (message_center_bubble() && | 408 return (message_center_bubble() && |
| 408 message_center_bubble()->bubble()->IsVisible()); | 409 message_center_bubble()->bubble()->IsVisible()); |
| 409 } | 410 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 return; | 607 return; |
| 607 | 608 |
| 608 message_center_tray_->HideMessageCenterBubble(); | 609 message_center_tray_->HideMessageCenterBubble(); |
| 609 } | 610 } |
| 610 | 611 |
| 611 message_center::MessageCenter* WebNotificationTray::message_center() const { | 612 message_center::MessageCenter* WebNotificationTray::message_center() const { |
| 612 return message_center_tray_->message_center(); | 613 return message_center_tray_->message_center(); |
| 613 } | 614 } |
| 614 | 615 |
| 615 bool WebNotificationTray::IsLoggedIn() const { | 616 bool WebNotificationTray::IsLoggedIn() const { |
| 616 WmShell* shell = WmShell::Get(); | 617 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus() != |
| 617 return shell->system_tray_delegate()->GetUserLoginStatus() != | |
| 618 LoginStatus::NOT_LOGGED_IN && | 618 LoginStatus::NOT_LOGGED_IN && |
| 619 !shell->session_controller()->IsInSecondaryLoginScreen(); | 619 !WmShell::Get()->session_controller()->IsInSecondaryLoginScreen(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 // Methods for testing | 622 // Methods for testing |
| 623 | 623 |
| 624 bool WebNotificationTray::IsPopupVisible() const { | 624 bool WebNotificationTray::IsPopupVisible() const { |
| 625 return message_center_tray_->popups_visible(); | 625 return message_center_tray_->popups_visible(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 message_center::MessageCenterBubble* | 628 message_center::MessageCenterBubble* |
| 629 WebNotificationTray::GetMessageCenterBubbleForTest() { | 629 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 630 if (!message_center_bubble()) | 630 if (!message_center_bubble()) |
| 631 return nullptr; | 631 return nullptr; |
| 632 return static_cast<message_center::MessageCenterBubble*>( | 632 return static_cast<message_center::MessageCenterBubble*>( |
| 633 message_center_bubble()->bubble()); | 633 message_center_bubble()->bubble()); |
| 634 } | 634 } |
| 635 | 635 |
| 636 } // namespace ash | 636 } // namespace ash |
| OLD | NEW |