OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 virtual void UpdateWithNotification(const Notification& notification); | 45 virtual void UpdateWithNotification(const Notification& notification); |
46 | 46 |
47 // Returns the insets for the shadow it will have for rich notification. | 47 // Returns the insets for the shadow it will have for rich notification. |
48 static gfx::Insets GetShadowInsets(); | 48 static gfx::Insets GetShadowInsets(); |
49 | 49 |
50 // Creates a shadow around the notification. | 50 // Creates a shadow around the notification. |
51 void CreateShadowBorder(); | 51 void CreateShadowBorder(); |
52 | 52 |
53 virtual bool IsCloseButtonFocused() const = 0; | 53 virtual bool IsCloseButtonFocused() const = 0; |
54 virtual void RequestFocusOnCloseButton() = 0; | 54 virtual void RequestFocusOnCloseButton() = 0; |
55 virtual bool IsPinned() const = 0; | |
56 virtual void UpdateControlButtonsVisibility() = 0; | 55 virtual void UpdateControlButtonsVisibility() = 0; |
57 | 56 |
58 void OnCloseButtonPressed(); | 57 void OnCloseButtonPressed(); |
59 | 58 |
60 // Overridden from views::View: | 59 // Overridden from views::View: |
61 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 60 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
62 bool OnMousePressed(const ui::MouseEvent& event) override; | 61 bool OnMousePressed(const ui::MouseEvent& event) override; |
63 bool OnKeyPressed(const ui::KeyEvent& event) override; | 62 bool OnKeyPressed(const ui::KeyEvent& event) override; |
64 bool OnKeyReleased(const ui::KeyEvent& event) override; | 63 bool OnKeyReleased(const ui::KeyEvent& event) override; |
65 void OnPaint(gfx::Canvas* canvas) override; | 64 void OnPaint(gfx::Canvas* canvas) override; |
66 void OnFocus() override; | 65 void OnFocus() override; |
67 void OnBlur() override; | 66 void OnBlur() override; |
68 void Layout() override; | 67 void Layout() override; |
69 | 68 |
70 // Overridden from ui::EventHandler: | 69 // Overridden from ui::EventHandler: |
71 void OnGestureEvent(ui::GestureEvent* event) override; | 70 void OnGestureEvent(ui::GestureEvent* event) override; |
72 | 71 |
73 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 72 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
74 std::string notification_id() { return notification_id_; } | 73 std::string notification_id() { return notification_id_; } |
75 NotifierId notifier_id() { return notifier_id_; } | 74 NotifierId notifier_id() { return notifier_id_; } |
76 const base::string16& display_source() const { return display_source_; } | 75 const base::string16& display_source() const { return display_source_; } |
| 76 bool pinned() const { return pinned_; } |
77 | 77 |
78 void set_controller(MessageCenterController* controller) { | 78 void set_controller(MessageCenterController* controller) { |
79 controller_ = controller; | 79 controller_ = controller; |
80 } | 80 } |
81 | 81 |
82 protected: | 82 protected: |
83 // Overridden from views::SlideOutView: | 83 // Overridden from views::SlideOutView: |
84 void OnSlideOut() override; | 84 void OnSlideOut() override; |
85 | 85 |
86 // Creates and add close button to view hierarchy when necessary. Derived | 86 // Creates and add close button to view hierarchy when necessary. Derived |
(...skipping 12 matching lines...) Expand all Loading... |
99 private: | 99 private: |
100 MessageCenterController* controller_; // Weak, lives longer then views. | 100 MessageCenterController* controller_; // Weak, lives longer then views. |
101 std::string notification_id_; | 101 std::string notification_id_; |
102 NotifierId notifier_id_; | 102 NotifierId notifier_id_; |
103 views::View* background_view_ = nullptr; // Owned by views hierarchy. | 103 views::View* background_view_ = nullptr; // Owned by views hierarchy. |
104 views::ScrollView* scroller_ = nullptr; | 104 views::ScrollView* scroller_ = nullptr; |
105 | 105 |
106 base::string16 accessible_name_; | 106 base::string16 accessible_name_; |
107 | 107 |
108 base::string16 display_source_; | 108 base::string16 display_source_; |
| 109 bool pinned_ = false; |
109 | 110 |
110 std::unique_ptr<views::Painter> focus_painter_; | 111 std::unique_ptr<views::Painter> focus_painter_; |
111 | 112 |
112 DISALLOW_COPY_AND_ASSIGN(MessageView); | 113 DISALLOW_COPY_AND_ASSIGN(MessageView); |
113 }; | 114 }; |
114 | 115 |
115 } // namespace message_center | 116 } // namespace message_center |
116 | 117 |
117 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ | 118 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
OLD | NEW |