OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" |
| 12 #include "ui/message_center/message_center_export.h" |
| 13 #include "ui/message_center/views/message_view.h" |
| 14 #include "ui/views/controls/button/button.h" |
| 15 #include "ui/views/controls/button/image_button.h" |
| 16 #include "ui/views/view_targeter_delegate.h" |
| 17 |
| 18 namespace views { |
| 19 class BoxLayout; |
| 20 class ImageView; |
| 21 } |
| 22 |
| 23 namespace message_center { |
| 24 |
| 25 class BoundedLabel; |
| 26 class NotificationButton; |
| 27 |
| 28 // View that displays all current types of notification (web, basic, image, and |
| 29 // list) except the custom notification. Future notification types may be |
| 30 // handled by other classes, in which case instances of those classes would be |
| 31 // returned by the Create() factory method below. |
| 32 class MESSAGE_CENTER_EXPORT NotificationViewMD |
| 33 : public MessageView, |
| 34 public views::ButtonListener, |
| 35 public views::ViewTargeterDelegate { |
| 36 public: |
| 37 NotificationViewMD(MessageCenterController* controller, |
| 38 const Notification& notification); |
| 39 ~NotificationViewMD() override; |
| 40 |
| 41 // Overridden from views::View: |
| 42 void Layout() override; |
| 43 void OnFocus() override; |
| 44 void ScrollRectToVisible(const gfx::Rect& rect) override; |
| 45 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
| 46 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 47 void OnMouseExited(const ui::MouseEvent& event) override; |
| 48 |
| 49 // Overridden from MessageView: |
| 50 void UpdateWithNotification(const Notification& notification) override; |
| 51 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 52 bool IsCloseButtonFocused() const override; |
| 53 void RequestFocusOnCloseButton() override; |
| 54 void UpdateControlButtonsVisibility() override; |
| 55 |
| 56 // views::ViewTargeterDelegate: |
| 57 views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override; |
| 58 |
| 59 private: |
| 60 void CreateOrUpdateViews(const Notification& notification); |
| 61 |
| 62 void CreateOrUpdateContextTitleView(const Notification& notification); |
| 63 void CreateOrUpdateTitleView(const Notification& notification); |
| 64 void CreateOrUpdateMessageView(const Notification& notification); |
| 65 void CreateOrUpdateProgressBarView(const Notification& notification); |
| 66 void CreateOrUpdateListItemViews(const Notification& notification); |
| 67 void CreateOrUpdateIconView(const Notification& notification); |
| 68 void CreateOrUpdateSmallIconView(const Notification& notification); |
| 69 void CreateOrUpdateImageView(const Notification& notification); |
| 70 void CreateOrUpdateActionButtonViews(const Notification& notification); |
| 71 void CreateOrUpdateCloseButtonView(const Notification& notification); |
| 72 void CreateOrUpdateSettingsButtonView(const Notification& notification); |
| 73 |
| 74 // Describes whether the view should display a hand pointer or not. |
| 75 bool clickable_; |
| 76 |
| 77 // Views in the top view |
| 78 views::BoxLayout* layout_ = nullptr; |
| 79 |
| 80 // Views in the top view |
| 81 views::View* top_view_ = nullptr; |
| 82 BoundedLabel* context_title_view_ = nullptr; |
| 83 |
| 84 // Views in the main view |
| 85 views::View* main_view_ = nullptr; |
| 86 BoundedLabel* title_view_ = nullptr; |
| 87 BoundedLabel* message_view_ = nullptr; |
| 88 |
| 89 // Views in the bottom view |
| 90 views::View* bottom_view_ = nullptr; |
| 91 |
| 92 // Views in the floating controller |
| 93 std::unique_ptr<views::ImageButton> settings_button_; |
| 94 std::unique_ptr<views::ImageButton> close_button_; |
| 95 std::unique_ptr<views::ImageView> small_image_view_; |
| 96 |
| 97 std::vector<NotificationButton*> action_buttons_; |
| 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(NotificationViewMD); |
| 100 }; |
| 101 |
| 102 } // namespace message_center |
| 103 |
| 104 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ |
OLD | NEW |