| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_MESSAGE_CENTER_VIEWS_GROUP_VIEW_H_ | |
| 6 #define UI_MESSAGE_CENTER_VIEWS_GROUP_VIEW_H_ | |
| 7 | |
| 8 #include "ui/gfx/image/image_skia.h" | |
| 9 #include "ui/message_center/views/message_center_controller.h" | |
| 10 #include "ui/message_center/views/message_center_view.h" | |
| 11 #include "ui/message_center/views/message_view.h" | |
| 12 | |
| 13 namespace message_center { | |
| 14 | |
| 15 class BoundedLabel; | |
| 16 class MessageCenter; | |
| 17 class NotificationButton; | |
| 18 | |
| 19 // View that displays a placeholder representing several notifications and a | |
| 20 // button to expand it into a set of individual notifications. | |
| 21 class GroupView : public MessageView, public MessageViewController { | |
| 22 public: | |
| 23 // The group view currently shows the latest notificaiton w/o buttons | |
| 24 // and a single button like "N more from XYZ". | |
| 25 // Each GroupView has a notifier_id which it uses to report clicks and other | |
| 26 // user actions to Client. | |
| 27 GroupView(MessageCenterController* controller, | |
| 28 const NotifierId& notifier_id, | |
| 29 const Notification& last_notification, | |
| 30 const gfx::ImageSkia& group_icon, | |
| 31 int group_size); | |
| 32 | |
| 33 virtual ~GroupView(); | |
| 34 | |
| 35 // Overridden from views::View: | |
| 36 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 37 virtual int GetHeightForWidth(int width) OVERRIDE; | |
| 38 virtual void Layout() OVERRIDE; | |
| 39 virtual void OnFocus() OVERRIDE; | |
| 40 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; | |
| 41 | |
| 42 // Overridden from MessageView: | |
| 43 virtual void ButtonPressed(views::Button* sender, | |
| 44 const ui::Event& event) OVERRIDE; | |
| 45 | |
| 46 // Overridden from MessageViewController: | |
| 47 virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; | |
| 48 virtual void RemoveNotification(const std::string& notification_id, | |
| 49 bool by_user) OVERRIDE; | |
| 50 | |
| 51 private: | |
| 52 MessageCenterController* controller_; // Weak, controls lifetime of views. | |
| 53 NotifierId notifier_id_; | |
| 54 base::string16 display_source_; | |
| 55 gfx::ImageSkia group_icon_; | |
| 56 int group_size_; | |
| 57 std::string last_notification_id_; | |
| 58 | |
| 59 // Weak references to GroupView descendants owned by their parents. | |
| 60 views::View* top_view_; | |
| 61 views::View* bottom_view_; | |
| 62 BoundedLabel* title_view_; | |
| 63 BoundedLabel* message_view_; | |
| 64 BoundedLabel* context_message_view_; | |
| 65 views::View* icon_view_; | |
| 66 NotificationButton* more_button_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(GroupView); | |
| 69 }; | |
| 70 | |
| 71 } // namespace message_center | |
| 72 | |
| 73 #endif // UI_MESSAGE_CENTER_VIEWS_GROUP_VIEW_H_ | |
| OLD | NEW |