Chromium Code Reviews| 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_NOTIFICATION_VIEW_MD_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/message_center/message_center_export.h" | 12 #include "ui/message_center/message_center_export.h" |
| 13 #include "ui/message_center/views/message_view.h" | 13 #include "ui/message_center/views/message_view.h" |
| 14 #include "ui/views/controls/button/button.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" | 15 #include "ui/views/view_targeter_delegate.h" |
| 17 | 16 |
| 18 namespace views { | 17 namespace views { |
| 19 class BoxLayout; | 18 class Label; |
| 20 class ImageView; | 19 class LabelButton; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace message_center { | 22 namespace message_center { |
| 24 | 23 |
| 25 class BoundedLabel; | 24 class BoundedLabel; |
| 26 class NotificationButton; | 25 class NotificationHeaderView; |
| 26 class ProportionalImageView; | |
| 27 | 27 |
| 28 // View that displays all current types of notification (web, basic, image, and | 28 // View that displays all current types of notification (web, basic, image, and |
| 29 // list) except the custom notification. Future notification types may be | 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 | 30 // handled by other classes, in which case instances of those classes would be |
| 31 // returned by the Create() factory method below. | 31 // returned by the Create() factory method below. |
| 32 class MESSAGE_CENTER_EXPORT NotificationViewMD | 32 class MESSAGE_CENTER_EXPORT NotificationViewMD |
| 33 : public MessageView, | 33 : public MessageView, |
| 34 public views::ButtonListener, | 34 public views::ButtonListener, |
| 35 public views::ViewTargeterDelegate { | 35 public views::ViewTargeterDelegate { |
| 36 public: | 36 public: |
| 37 NotificationViewMD(MessageCenterController* controller, | 37 NotificationViewMD(MessageCenterController* controller, |
| 38 const Notification& notification); | 38 const Notification& notification); |
| 39 ~NotificationViewMD() override; | 39 ~NotificationViewMD() override; |
| 40 | 40 |
| 41 // Overridden from views::View: | 41 // Overridden from views::View: |
| 42 void Layout() override; | 42 void Layout() override; |
| 43 void OnFocus() override; | 43 void OnFocus() override; |
| 44 void ScrollRectToVisible(const gfx::Rect& rect) override; | 44 void ScrollRectToVisible(const gfx::Rect& rect) override; |
| 45 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; | 45 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
| 46 void OnMouseMoved(const ui::MouseEvent& event) override; | |
| 46 void OnMouseEntered(const ui::MouseEvent& event) override; | 47 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 47 void OnMouseExited(const ui::MouseEvent& event) override; | 48 void OnMouseExited(const ui::MouseEvent& event) override; |
| 48 | 49 |
| 49 // Overridden from MessageView: | 50 // Overridden from MessageView: |
| 50 void UpdateWithNotification(const Notification& notification) override; | 51 void UpdateWithNotification(const Notification& notification) override; |
| 51 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 52 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 52 bool IsCloseButtonFocused() const override; | 53 bool IsCloseButtonFocused() const override; |
| 53 void RequestFocusOnCloseButton() override; | 54 void RequestFocusOnCloseButton() override; |
| 54 void UpdateControlButtonsVisibility() override; | 55 void UpdateControlButtonsVisibility() override; |
| 55 | 56 |
| 56 // views::ViewTargeterDelegate: | 57 // views::ViewTargeterDelegate: |
| 57 views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override; | 58 views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override; |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 void CreateOrUpdateViews(const Notification& notification); | 61 void CreateOrUpdateViews(const Notification& notification); |
| 61 | 62 |
| 62 void CreateOrUpdateContextTitleView(const Notification& notification); | 63 void CreateOrUpdateContextTitleView(const Notification& notification); |
| 63 void CreateOrUpdateTitleView(const Notification& notification); | 64 void CreateOrUpdateTitleView(const Notification& notification); |
| 64 void CreateOrUpdateMessageView(const Notification& notification); | 65 void CreateOrUpdateMessageView(const Notification& notification); |
| 65 void CreateOrUpdateProgressBarView(const Notification& notification); | 66 void CreateOrUpdateProgressBarView(const Notification& notification); |
| 66 void CreateOrUpdateListItemViews(const Notification& notification); | 67 void CreateOrUpdateListItemViews(const Notification& notification); |
| 67 void CreateOrUpdateIconView(const Notification& notification); | 68 void CreateOrUpdateIconView(const Notification& notification); |
| 68 void CreateOrUpdateSmallIconView(const Notification& notification); | 69 void CreateOrUpdateSmallIconView(const Notification& notification); |
| 69 void CreateOrUpdateImageView(const Notification& notification); | 70 void CreateOrUpdateImageView(const Notification& notification); |
| 70 void CreateOrUpdateActionButtonViews(const Notification& notification); | 71 void CreateOrUpdateActionButtonViews(const Notification& notification); |
| 71 void CreateOrUpdateCloseButtonView(const Notification& notification); | 72 void CreateOrUpdateCloseButtonView(const Notification& notification); |
| 72 void CreateOrUpdateSettingsButtonView(const Notification& notification); | 73 void CreateOrUpdateSettingsButtonView(const Notification& notification); |
| 73 | 74 |
| 75 bool IsExpandable(); | |
| 76 void ToggleExpanded(); | |
| 77 void UpdateViewForExpandedState(bool expanded); | |
| 78 | |
| 79 // True if this view or its descendant views have focus. | |
| 80 bool HasFocusedView(); | |
| 81 | |
| 82 // Whether this notification is expanded or not. | |
| 83 bool expanded_ = false; | |
| 84 | |
| 74 // Describes whether the view should display a hand pointer or not. | 85 // Describes whether the view should display a hand pointer or not. |
| 75 bool clickable_; | 86 bool clickable_; |
| 76 | 87 |
| 77 // Views in the top view | 88 // Container views directly attached to this view. |
| 78 views::BoxLayout* layout_ = nullptr; | 89 NotificationHeaderView* header_row_ = nullptr; |
|
fukino
2017/06/08 22:05:48
I renamed top_view_, main_view_, and bottom_view t
| |
| 90 views::View* content_row_ = nullptr; | |
| 91 views::View* actions_row_ = nullptr; | |
| 79 | 92 |
| 80 // Views in the top view | 93 // Containers for left and right side on |content_row_| |
| 81 views::View* top_view_ = nullptr; | 94 views::View* left_content_ = nullptr; |
| 82 BoundedLabel* context_title_view_ = nullptr; | 95 views::View* right_content_ = nullptr; |
| 83 | 96 |
| 84 // Views in the main view | 97 // Views which are dinamicallly created inside view hierarchy. |
| 85 views::View* main_view_ = nullptr; | 98 views::Label* title_view_ = nullptr; |
| 86 BoundedLabel* title_view_ = nullptr; | |
| 87 BoundedLabel* message_view_ = nullptr; | 99 BoundedLabel* message_view_ = nullptr; |
| 88 | 100 ProportionalImageView* icon_view_ = nullptr; |
| 89 // Views in the bottom view | 101 views::View* image_container_ = nullptr; |
| 90 views::View* bottom_view_ = nullptr; | 102 ProportionalImageView* image_view_ = nullptr; |
| 91 | 103 std::vector<views::LabelButton*> action_buttons_; |
| 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 | 104 |
| 99 DISALLOW_COPY_AND_ASSIGN(NotificationViewMD); | 105 DISALLOW_COPY_AND_ASSIGN(NotificationViewMD); |
| 100 }; | 106 }; |
| 101 | 107 |
| 102 } // namespace message_center | 108 } // namespace message_center |
| 103 | 109 |
| 104 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ | 110 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_VIEW_MD_H_ |
| OLD | NEW |