| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void ClickOnSettingsButton(const std::string& notification_id) override; | 87 void ClickOnSettingsButton(const std::string& notification_id) override; |
| 88 | 88 |
| 89 // Overridden from gfx::AnimationDelegate: | 89 // Overridden from gfx::AnimationDelegate: |
| 90 void AnimationEnded(const gfx::Animation* animation) override; | 90 void AnimationEnded(const gfx::Animation* animation) override; |
| 91 void AnimationProgressed(const gfx::Animation* animation) override; | 91 void AnimationProgressed(const gfx::Animation* animation) override; |
| 92 void AnimationCanceled(const gfx::Animation* animation) override; | 92 void AnimationCanceled(const gfx::Animation* animation) override; |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 friend class MessageCenterViewTest; | 95 friend class MessageCenterViewTest; |
| 96 | 96 |
| 97 enum class Mode { NOTIFICATIONS, SETTINGS, BUTTONS_ONLY }; |
| 98 |
| 97 void AddNotificationAt(const Notification& notification, int index); | 99 void AddNotificationAt(const Notification& notification, int index); |
| 98 void NotificationsChanged(); | |
| 99 base::string16 GetButtonBarTitle() const; | 100 base::string16 GetButtonBarTitle() const; |
| 101 void Update(bool animate); |
| 102 void SetVisibilityMode(Mode mode, bool animate); |
| 103 void UpdateButtonBarStatus(); |
| 100 void SetNotificationViewForTest(MessageView* view); | 104 void SetNotificationViewForTest(MessageView* view); |
| 101 | 105 |
| 102 MessageCenter* message_center_; // Weak reference. | 106 MessageCenter* message_center_; // Weak reference. |
| 103 MessageCenterTray* tray_; // Weak reference. | 107 MessageCenterTray* tray_; // Weak reference. |
| 104 | 108 |
| 105 // Map notification_id->MessageView*. It contains all MessageViews currently | 109 // Map notification_id->MessageView*. It contains all MessageViews currently |
| 106 // displayed in MessageCenter. | 110 // displayed in MessageCenter. |
| 107 typedef std::map<std::string, MessageView*> NotificationViewsMap; | 111 typedef std::map<std::string, MessageView*> NotificationViewsMap; |
| 108 NotificationViewsMap notification_views_; // Weak. | 112 NotificationViewsMap notification_views_; // Weak. |
| 109 | 113 |
| 110 // Child views. | 114 // Child views. |
| 111 views::ScrollView* scroller_; | 115 views::ScrollView* scroller_; |
| 112 std::unique_ptr<MessageListView> message_list_view_; | 116 std::unique_ptr<MessageListView> message_list_view_; |
| 113 std::unique_ptr<views::View> empty_list_view_; | |
| 114 NotifierSettingsView* settings_view_; | 117 NotifierSettingsView* settings_view_; |
| 115 MessageCenterButtonBar* button_bar_; | 118 MessageCenterButtonBar* button_bar_; |
| 116 bool top_down_; | 119 bool top_down_; |
| 117 | 120 |
| 118 // Data for transition animation between settings view and message list. | 121 // Data for transition animation between settings view and message list. |
| 119 bool settings_visible_; | 122 bool settings_visible_; |
| 120 | 123 |
| 121 // Animation managing transition between message center and settings (and vice | 124 // Animation managing transition between message center and settings (and vice |
| 122 // versa). | 125 // versa). |
| 123 std::unique_ptr<gfx::MultiAnimation> settings_transition_animation_; | 126 std::unique_ptr<gfx::MultiAnimation> settings_transition_animation_; |
| 124 | 127 |
| 125 // Helper data to keep track of the transition between settings and | 128 // Helper data to keep track of the transition between settings and |
| 126 // message center views. | 129 // message center views. |
| 127 views::View* source_view_; | 130 views::View* source_view_; |
| 128 int source_height_; | 131 int source_height_; |
| 129 views::View* target_view_; | 132 views::View* target_view_; |
| 130 int target_height_; | 133 int target_height_; |
| 131 | 134 |
| 132 // True when the widget is closing so that further operations should be | 135 // True when the widget is closing so that further operations should be |
| 133 // ignored. | 136 // ignored. |
| 134 bool is_closing_; | 137 bool is_closing_; |
| 135 | 138 |
| 139 bool is_clearing_ = false; |
| 140 |
| 141 // Current view mode. During animation, it is the target mode. |
| 142 Mode mode_ = Mode::BUTTONS_ONLY; |
| 143 |
| 136 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; | 144 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; |
| 137 | 145 |
| 138 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); | 146 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); |
| 139 }; | 147 }; |
| 140 | 148 |
| 141 } // namespace message_center | 149 } // namespace message_center |
| 142 | 150 |
| 143 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 151 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
| OLD | NEW |