Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ui / message_center / views / notification_view.h
blob3070d2352c0cdd8b50bf29ea09321ff6a108e653
1 // Copyright (c) 2012 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.
5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_
8 #include <vector>
10 #include "ui/message_center/message_center_export.h"
11 #include "ui/message_center/views/message_view.h"
13 namespace message_center {
15 class BoundedLabel;
16 class NotificationChangeObserver;
18 // View that displays all current types of notification (web, basic, image, and
19 // list). Future notification types may be handled by other classes, in which
20 // case instances of those classes would be returned by the Create() factory
21 // method below.
22 class MESSAGE_CENTER_EXPORT NotificationView : public MessageView {
23 public:
24 // Creates appropriate MessageViews for notifications. Those currently are
25 // always NotificationView or MessageSimpleView instances but in the future
26 // may be instances of other classes, with the class depending on the
27 // notification type.
28 static MessageView* Create(const Notification& notification,
29 NotificationChangeObserver* observer,
30 bool expanded);
32 virtual ~NotificationView();
34 // Overridden from views::View:
35 virtual gfx::Size GetPreferredSize() OVERRIDE;
36 virtual int GetHeightForWidth(int width) OVERRIDE;
37 virtual void Layout() OVERRIDE;
39 // Overridden from MessageView:
40 virtual void ButtonPressed(views::Button* sender,
41 const ui::Event& event) OVERRIDE;
43 protected:
44 NotificationView(const Notification& notification,
45 NotificationChangeObserver* observer,
46 bool expanded);
48 private:
49 bool IsExpansionNeeded();
50 size_t GetMessageLineLimit();
52 // Weak references to NotificationView descendants owned by their parents.
53 views::View* background_view_;
54 views::View* top_view_;
55 BoundedLabel* title_view_;
56 BoundedLabel* message_view_;
57 std::vector<views::View*> item_views_;
58 views::View* icon_view_;
59 views::View* bottom_view_;
60 views::View* image_view_;
61 std::vector<views::View*> action_buttons_;
63 DISALLOW_COPY_AND_ASSIGN(NotificationView);
66 } // namespace message_center
68 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_H_