| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Returns the insets for the shadow it will have for rich notification. | 55 // Returns the insets for the shadow it will have for rich notification. |
| 56 static gfx::Insets GetShadowInsets(); | 56 static gfx::Insets GetShadowInsets(); |
| 57 | 57 |
| 58 // Creates a shadow around the notification. | 58 // Creates a shadow around the notification. |
| 59 void CreateShadowBorder(); | 59 void CreateShadowBorder(); |
| 60 | 60 |
| 61 bool IsCloseButtonFocused(); | 61 bool IsCloseButtonFocused(); |
| 62 void RequestFocusOnCloseButton(); | 62 void RequestFocusOnCloseButton(); |
| 63 bool IsPinned(); | 63 bool IsPinned(); |
| 64 | 64 |
| 65 void set_accessible_name(const base::string16& accessible_name) { | |
| 66 accessible_name_ = accessible_name; | |
| 67 } | |
| 68 | |
| 69 // Overridden from views::View: | 65 // Overridden from views::View: |
| 70 void GetAccessibleState(ui::AXViewState* state) override; | 66 void GetAccessibleState(ui::AXViewState* state) override; |
| 71 bool OnMousePressed(const ui::MouseEvent& event) override; | 67 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 72 bool OnKeyPressed(const ui::KeyEvent& event) override; | 68 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 73 bool OnKeyReleased(const ui::KeyEvent& event) override; | 69 bool OnKeyReleased(const ui::KeyEvent& event) override; |
| 74 void OnPaint(gfx::Canvas* canvas) override; | 70 void OnPaint(gfx::Canvas* canvas) override; |
| 75 void OnFocus() override; | 71 void OnFocus() override; |
| 76 void OnBlur() override; | 72 void OnBlur() override; |
| 77 void Layout() override; | 73 void Layout() override; |
| 78 | 74 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 97 | 93 |
| 98 // Creates and add close button to view hierarchy when necessary. Derived | 94 // Creates and add close button to view hierarchy when necessary. Derived |
| 99 // classes should call this after its view hierarchy is populated to ensure | 95 // classes should call this after its view hierarchy is populated to ensure |
| 100 // it is on top of other views. | 96 // it is on top of other views. |
| 101 void CreateOrUpdateCloseButtonView(const Notification& notification); | 97 void CreateOrUpdateCloseButtonView(const Notification& notification); |
| 102 | 98 |
| 103 // Changes the background color being used by |background_view_| and schedules | 99 // Changes the background color being used by |background_view_| and schedules |
| 104 // a paint. | 100 // a paint. |
| 105 virtual void SetDrawBackgroundAsActive(bool active); | 101 virtual void SetDrawBackgroundAsActive(bool active); |
| 106 | 102 |
| 103 // Creates a text for spoken feedback from the data contained |
| 104 // in the notification. |
| 105 base::string16 CreateAccessibleName(const Notification& notification); |
| 106 |
| 107 views::View* background_view() { return background_view_; } | 107 views::View* background_view() { return background_view_; } |
| 108 views::ImageView* small_image() { return small_image_view_.get(); } | 108 views::ImageView* small_image() { return small_image_view_.get(); } |
| 109 views::ImageButton* close_button() { return close_button_.get(); } | 109 views::ImageButton* close_button() { return close_button_.get(); } |
| 110 views::ScrollView* scroller() { return scroller_; } | 110 views::ScrollView* scroller() { return scroller_; } |
| 111 MessageCenterController* controller() { return controller_; } | 111 MessageCenterController* controller() { return controller_; } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 MessageCenterController* controller_; // Weak, lives longer then views. | 114 MessageCenterController* controller_; // Weak, lives longer then views. |
| 115 std::string notification_id_; | 115 std::string notification_id_; |
| 116 NotifierId notifier_id_; | 116 NotifierId notifier_id_; |
| 117 views::View* background_view_ = nullptr; // Owned by views hierarchy. | 117 views::View* background_view_ = nullptr; // Owned by views hierarchy. |
| 118 std::unique_ptr<views::ImageView> small_image_view_; | 118 std::unique_ptr<views::ImageView> small_image_view_; |
| 119 std::unique_ptr<views::ImageButton> close_button_; | 119 std::unique_ptr<views::ImageButton> close_button_; |
| 120 views::ScrollView* scroller_ = nullptr; | 120 views::ScrollView* scroller_ = nullptr; |
| 121 | 121 |
| 122 base::string16 accessible_name_; | 122 base::string16 accessible_name_; |
| 123 | 123 |
| 124 base::string16 display_source_; | 124 base::string16 display_source_; |
| 125 | 125 |
| 126 std::unique_ptr<views::Painter> focus_painter_; | 126 std::unique_ptr<views::Painter> focus_painter_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(MessageView); | 128 DISALLOW_COPY_AND_ASSIGN(MessageView); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace message_center | 131 } // namespace message_center |
| 132 | 132 |
| 133 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ | 133 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_VIEW_H_ |
| OLD | NEW |