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