| 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" |
| 11 #include "ui/gfx/animation/animation_delegate.h" | 11 #include "ui/gfx/animation/animation_delegate.h" |
| 12 #include "ui/message_center/message_center_export.h" | 12 #include "ui/message_center/message_center_export.h" |
| 13 #include "ui/message_center/message_center_observer.h" | 13 #include "ui/message_center/message_center_observer.h" |
| 14 #include "ui/message_center/notification_list.h" | 14 #include "ui/message_center/notification_list.h" |
| 15 #include "ui/message_center/views/message_center_controller.h" | 15 #include "ui/message_center/views/message_center_controller.h" |
| 16 #include "ui/message_center/views/message_list_view.h" | 16 #include "ui/message_center/views/message_list_view.h" |
| 17 #include "ui/message_center/views/message_view.h" | 17 #include "ui/message_center/views/message_view.h" |
| 18 #include "ui/views/focus/focus_manager.h" |
| 18 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 19 | 20 |
| 20 namespace gfx { | 21 namespace gfx { |
| 21 class MultiAnimation; | 22 class MultiAnimation; |
| 22 } // namespace gfx | 23 } // namespace gfx |
| 23 | 24 |
| 24 namespace message_center { | 25 namespace message_center { |
| 25 | 26 |
| 26 class MessageCenter; | 27 class MessageCenter; |
| 27 class MessageCenterButtonBar; | 28 class MessageCenterButtonBar; |
| 28 class MessageCenterTray; | 29 class MessageCenterTray; |
| 29 class MessageView; | 30 class MessageView; |
| 30 class MessageViewContextMenuController; | 31 class MessageViewContextMenuController; |
| 31 class MessageListView; | 32 class MessageListView; |
| 32 class NotifierSettingsView; | 33 class NotifierSettingsView; |
| 33 | 34 |
| 34 // Container for all the top-level views in the notification center, such as the | 35 // Container for all the top-level views in the notification center, such as the |
| 35 // button bar, settings view, scrol view, and message list view. Acts as a | 36 // button bar, settings view, scrol view, and message list view. Acts as a |
| 36 // controller for the message list view, passing data back and forth to message | 37 // controller for the message list view, passing data back and forth to message |
| 37 // center. | 38 // center. |
| 38 class MESSAGE_CENTER_EXPORT MessageCenterView | 39 class MESSAGE_CENTER_EXPORT MessageCenterView |
| 39 : public views::View, | 40 : public views::View, |
| 40 public MessageCenterObserver, | 41 public MessageCenterObserver, |
| 41 public MessageCenterController, | 42 public MessageCenterController, |
| 42 public MessageListView::Observer, | 43 public MessageListView::Observer, |
| 43 public gfx::AnimationDelegate { | 44 public gfx::AnimationDelegate, |
| 45 public views::FocusChangeListener { |
| 44 public: | 46 public: |
| 45 MessageCenterView(MessageCenter* message_center, | 47 MessageCenterView(MessageCenter* message_center, |
| 46 MessageCenterTray* tray, | 48 MessageCenterTray* tray, |
| 47 int max_height, | 49 int max_height, |
| 48 bool initially_settings_visible); | 50 bool initially_settings_visible); |
| 49 ~MessageCenterView() override; | 51 ~MessageCenterView() override; |
| 50 | 52 |
| 53 void Init(); |
| 54 |
| 51 void SetNotifications(const NotificationList::Notifications& notifications); | 55 void SetNotifications(const NotificationList::Notifications& notifications); |
| 52 | 56 |
| 53 void ClearAllClosableNotifications(); | 57 void ClearAllClosableNotifications(); |
| 54 | 58 |
| 55 size_t NumMessageViewsForTest() const; | 59 size_t NumMessageViewsForTest() const; |
| 56 | 60 |
| 57 void SetSettingsVisible(bool visible); | 61 void SetSettingsVisible(bool visible); |
| 58 void OnSettingsChanged(); | 62 void OnSettingsChanged(); |
| 59 bool settings_visible() const { return settings_visible_; } | 63 bool settings_visible() const { return settings_visible_; } |
| 60 MessageCenterTray* tray() { return tray_; } | 64 MessageCenterTray* tray() { return tray_; } |
| 61 | 65 |
| 62 void SetIsClosing(bool is_closing); | 66 void SetIsClosing(bool is_closing); |
| 63 | 67 |
| 68 // Overridden from views::FocusChangeListener |
| 69 void OnWillChangeFocus(views::View* before, views::View* now) override {} |
| 70 void OnDidChangeFocus(views::View* before, views::View* now) override; |
| 71 |
| 64 protected: | 72 protected: |
| 65 // Potentially sets the reposition target, and then returns whether or not it | 73 // Potentially sets the reposition target, and then returns whether or not it |
| 66 // was was set. | 74 // was was set. |
| 67 virtual bool SetRepositionTarget(); | 75 virtual bool SetRepositionTarget(); |
| 68 | 76 |
| 69 // Overridden from views::View: | 77 // Overridden from views::View: |
| 70 void Layout() override; | 78 void Layout() override; |
| 71 gfx::Size GetPreferredSize() const override; | 79 gfx::Size GetPreferredSize() const override; |
| 72 int GetHeightForWidth(int width) const override; | 80 int GetHeightForWidth(int width) const override; |
| 73 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | 81 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 bool is_closing_; | 156 bool is_closing_; |
| 149 | 157 |
| 150 bool is_clearing_ = false; | 158 bool is_clearing_ = false; |
| 151 bool is_locked_ = false; | 159 bool is_locked_ = false; |
| 152 | 160 |
| 153 // Current view mode. During animation, it is the target mode. | 161 // Current view mode. During animation, it is the target mode. |
| 154 Mode mode_ = Mode::BUTTONS_ONLY; | 162 Mode mode_ = Mode::BUTTONS_ONLY; |
| 155 | 163 |
| 156 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; | 164 std::unique_ptr<MessageViewContextMenuController> context_menu_controller_; |
| 157 | 165 |
| 166 views::FocusManager* focus_manager_ = nullptr; |
| 167 |
| 158 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); | 168 DISALLOW_COPY_AND_ASSIGN(MessageCenterView); |
| 159 }; | 169 }; |
| 160 | 170 |
| 161 } // namespace message_center | 171 } // namespace message_center |
| 162 | 172 |
| 163 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ | 173 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_CENTER_VIEW_H_ |
| OLD | NEW |