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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void Layout() override; | 66 void Layout() override; |
67 gfx::Size GetPreferredSize() const override; | 67 gfx::Size GetPreferredSize() const override; |
68 int GetHeightForWidth(int width) const override; | 68 int GetHeightForWidth(int width) const override; |
69 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | 69 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
70 void OnMouseExited(const ui::MouseEvent& event) override; | 70 void OnMouseExited(const ui::MouseEvent& event) override; |
71 | 71 |
72 // Overridden from MessageCenterObserver: | 72 // Overridden from MessageCenterObserver: |
73 void OnNotificationAdded(const std::string& id) override; | 73 void OnNotificationAdded(const std::string& id) override; |
74 void OnNotificationRemoved(const std::string& id, bool by_user) override; | 74 void OnNotificationRemoved(const std::string& id, bool by_user) override; |
75 void OnNotificationUpdated(const std::string& id) override; | 75 void OnNotificationUpdated(const std::string& id) override; |
| 76 void OnLockedStateChanged(bool locked) override; |
76 | 77 |
77 // Overridden from MessageCenterController: | 78 // Overridden from MessageCenterController: |
78 void ClickOnNotification(const std::string& notification_id) override; | 79 void ClickOnNotification(const std::string& notification_id) override; |
79 void RemoveNotification(const std::string& notification_id, | 80 void RemoveNotification(const std::string& notification_id, |
80 bool by_user) override; | 81 bool by_user) override; |
81 std::unique_ptr<ui::MenuModel> CreateMenuModel( | 82 std::unique_ptr<ui::MenuModel> CreateMenuModel( |
82 const NotifierId& notifier_id, | 83 const NotifierId& notifier_id, |
83 const base::string16& display_source) override; | 84 const base::string16& display_source) override; |
84 bool HasClickedListener(const std::string& notification_id) override; | 85 bool HasClickedListener(const std::string& notification_id) override; |
85 void ClickOnNotificationButton(const std::string& notification_id, | 86 void ClickOnNotificationButton(const std::string& notification_id, |
86 int button_index) override; | 87 int button_index) override; |
87 void ClickOnSettingsButton(const std::string& notification_id) override; | 88 void ClickOnSettingsButton(const std::string& notification_id) override; |
88 | 89 |
89 // Overridden from gfx::AnimationDelegate: | 90 // Overridden from gfx::AnimationDelegate: |
90 void AnimationEnded(const gfx::Animation* animation) override; | 91 void AnimationEnded(const gfx::Animation* animation) override; |
91 void AnimationProgressed(const gfx::Animation* animation) override; | 92 void AnimationProgressed(const gfx::Animation* animation) override; |
92 void AnimationCanceled(const gfx::Animation* animation) override; | 93 void AnimationCanceled(const gfx::Animation* animation) override; |
93 | 94 |
94 private: | 95 private: |
95 friend class MessageCenterViewTest; | 96 friend class MessageCenterViewTest; |
96 | 97 |
97 enum class Mode { NOTIFICATIONS, SETTINGS, BUTTONS_ONLY }; | 98 enum class Mode { NOTIFICATIONS, SETTINGS, BUTTONS_ONLY }; |
98 | 99 |
| 100 static bool disable_animation_for_testing; |
| 101 |
99 void AddNotificationAt(const Notification& notification, int index); | 102 void AddNotificationAt(const Notification& notification, int index); |
100 base::string16 GetButtonBarTitle() const; | 103 base::string16 GetButtonBarTitle() const; |
101 void Update(bool animate); | 104 void Update(bool animate); |
102 void SetVisibilityMode(Mode mode, bool animate); | 105 void SetVisibilityMode(Mode mode, bool animate); |
103 void UpdateButtonBarStatus(); | 106 void UpdateButtonBarStatus(); |
104 void SetNotificationViewForTest(MessageView* view); | 107 void SetNotificationViewForTest(MessageView* view); |
105 | 108 |
106 MessageCenter* message_center_; // Weak reference. | 109 MessageCenter* message_center_; // Weak reference. |
107 MessageCenterTray* tray_; // Weak reference. | 110 MessageCenterTray* tray_; // Weak reference. |
108 | 111 |
(...skipping 21 matching lines...) Expand all Loading... |
130 views::View* source_view_; | 133 views::View* source_view_; |
131 int source_height_; | 134 int source_height_; |
132 views::View* target_view_; | 135 views::View* target_view_; |
133 int target_height_; | 136 int target_height_; |
134 | 137 |
135 // True when the widget is closing so that further operations should be | 138 // True when the widget is closing so that further operations should be |
136 // ignored. | 139 // ignored. |
137 bool is_closing_; | 140 bool is_closing_; |
138 | 141 |
139 bool is_clearing_ = false; | 142 bool is_clearing_ = false; |
| 143 bool is_locked_ = false; |
140 | 144 |
141 // Current view mode. During animation, it is the target mode. | 145 // Current view mode. During animation, it is the target mode. |
142 Mode mode_ = Mode::BUTTONS_ONLY; | 146 Mode mode_ = Mode::BUTTONS_ONLY; |
143 | 147 |
144 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; | 148 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; |
145 | 149 |
146 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); | 150 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); |
147 }; | 151 }; |
148 | 152 |
149 } // namespace message_center | 153 } // namespace message_center |
150 | 154 |
151 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 155 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
OLD | NEW |