Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3750)

Unified Diff: ash/common/system/web_notification/web_notification_tray.h

Issue 2732813002: chromeos: Move files in //ash/common to //ash, part 1 (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/system/web_notification/web_notification_tray.h
diff --git a/ash/common/system/web_notification/web_notification_tray.h b/ash/common/system/web_notification/web_notification_tray.h
deleted file mode 100644
index ce64dd8ac6342628c87d995fa7173a00d02e1ba6..0000000000000000000000000000000000000000
--- a/ash/common/system/web_notification/web_notification_tray.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_COMMON_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_
-#define ASH_COMMON_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_
-
-#include <memory>
-
-#include "ash/ash_export.h"
-#include "ash/common/login_status.h"
-#include "ash/common/system/tray/tray_background_view.h"
-#include "base/gtest_prod_util.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "ui/base/models/simple_menu_model.h"
-#include "ui/gfx/animation/animation_container.h"
-#include "ui/message_center/message_center_tray.h"
-#include "ui/message_center/message_center_tray_delegate.h"
-#include "ui/views/bubble/tray_bubble_view.h"
-
-// Status area tray for showing browser and app notifications. This hosts
-// a MessageCenter class which manages the notification list. This class
-// contains the Ash specific tray implementation.
-//
-// Note: These are not related to system notifications (i.e NotificationView
-// generated by SystemTrayItem). Visibility of one notification type or other
-// is controlled by StatusAreaWidget.
-
-namespace message_center {
-class MessageCenter;
-class MessageCenterBubble;
-class MessagePopupCollection;
-}
-
-namespace ash {
-class AshPopupAlignmentDelegate;
-class SystemTray;
-class WebNotificationBubbleWrapper;
-class WebNotificationImage;
-class WebNotificationLabel;
-class WmWindow;
-
-class ASH_EXPORT WebNotificationTray
- : public TrayBackgroundView,
- public views::TrayBubbleView::Delegate,
- public message_center::MessageCenterTrayDelegate,
- public base::SupportsWeakPtr<WebNotificationTray>,
- public ui::SimpleMenuModel::Delegate {
- public:
- WebNotificationTray(WmShelf* shelf,
- WmWindow* status_area_window,
- SystemTray* system_tray);
- ~WebNotificationTray() override;
-
- static void DisableAnimationsForTest(bool disable);
-
- // Sets the height of the system tray bubble (or legacy notification bubble)
- // from the edge of the work area so that the web notification popups don't
- // overlap with the tray. Pass 0 if no bubble is shown.
- void SetTrayBubbleHeight(int height);
-
- // Returns the current tray bubble height or 0 if there is no bubble.
- int tray_bubble_height_for_test() const;
-
- // Returns true if it should block the auto hide behavior of the shelf.
- bool ShouldBlockShelfAutoHide() const;
-
- // Returns true if the message center bubble is visible.
- bool IsMessageCenterBubbleVisible() const;
-
- // Shows the message center bubble.
- void ShowMessageCenterBubble();
-
- // Called when the login status is changed.
- void UpdateAfterLoginStatusChange(LoginStatus login_status);
-
- // Overridden from TrayBackgroundView.
- void SetShelfAlignment(ShelfAlignment alignment) override;
- void AnchorUpdated() override;
- base::string16 GetAccessibleNameForTray() override;
- void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
- void ClickedOutsideBubble() override;
-
- // Overridden from ActionableView.
- bool PerformAction(const ui::Event& event) override;
-
- // Overridden from views::TrayBubbleView::Delegate.
- void BubbleViewDestroyed() override;
- void OnMouseEnteredView() override;
- void OnMouseExitedView() override;
- base::string16 GetAccessibleNameForBubble() override;
- void OnBeforeBubbleWidgetInit(
- views::Widget* anchor_widget,
- views::Widget* bubble_widget,
- views::Widget::InitParams* params) const override;
- void HideBubble(const views::TrayBubbleView* bubble_view) override;
-
- // Overridden from MessageCenterTrayDelegate.
- void OnMessageCenterTrayChanged() override;
- bool ShowMessageCenter() override;
- void HideMessageCenter() override;
- bool ShowPopups() override;
- void HidePopups() override;
- bool ShowNotifierSettings() override;
- bool IsContextMenuEnabled() const override;
- message_center::MessageCenterTray* GetMessageCenterTray() override;
-
- // Overridden from ui::SimpleMenuModel::Delegate.
- bool IsCommandIdChecked(int command_id) const override;
- bool IsCommandIdEnabled(int command_id) const override;
- void ExecuteCommand(int command_id, int event_flags) override;
-
- message_center::MessageCenter* message_center() const;
-
- private:
- friend class WebNotificationTrayTest;
-
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationPopupBubble);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest,
- ManyMessageCenterNotifications);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, ManyPopupNotifications);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, PopupShownOnBothDisplays);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, PopupAndSystemTray);
- FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, PopupAndAutoHideShelf);
-
- void UpdateTrayContent();
-
- // The actual process to show the message center. Set |show_settings| to true
- // if the message center should be initialized with the settings visible.
- // Returns true if the center is successfully created.
- bool ShowMessageCenterInternal(bool show_settings);
-
- // Queries login status and the status area widget to determine visibility of
- // the message center.
- bool ShouldShowMessageCenter();
-
- // Returns true if it should show the quiet mode menu.
- bool ShouldShowQuietModeMenu(const ui::Event& event);
-
- // Shows the quiet mode menu.
- void ShowQuietModeMenu(const ui::Event& event);
-
- // Creates the menu model for quiet mode and returns it.
- ui::MenuModel* CreateQuietModeMenu();
-
- WebNotificationBubbleWrapper* message_center_bubble() const {
- return message_center_bubble_.get();
- }
-
- // Returns true if any user is logged in and the system is not at the screen
- // for adding a secondary user.
- bool IsLoggedIn() const;
-
- // Testing accessors.
- bool IsPopupVisible() const;
- message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
-
- WmWindow* status_area_window_;
- SystemTray* system_tray_;
- std::unique_ptr<message_center::MessageCenterTray> message_center_tray_;
- std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_;
- std::unique_ptr<message_center::MessagePopupCollection> popup_collection_;
- std::unique_ptr<WebNotificationImage> bell_icon_;
- std::unique_ptr<WebNotificationLabel> counter_;
-
- scoped_refptr<gfx::AnimationContainer> animation_container_ =
- new gfx::AnimationContainer();
-
- std::unordered_map<std::string, WebNotificationImage*> visible_small_icons_;
-
- bool show_message_center_on_unlock_;
-
- bool should_update_tray_content_;
-
- // True when the shelf auto hide behavior has to be blocked. Previously
- // this was done by checking |message_center_bubble_| but actually
- // the check can be called when creating this object, so it would cause
- // flickers of the shelf from hidden to shown. See: crbug.com/181213
- bool should_block_shelf_auto_hide_;
-
- std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(WebNotificationTray);
-};
-
-} // namespace ash
-
-#endif // ASH_COMMON_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_

Powered by Google App Engine
This is Rietveld 408576698