| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_HEADER_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_HEADER_VIEW_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_HEADER_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_HEADER_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/message_center/views/padded_button.h" | 9 #include "ui/message_center/views/padded_button.h" |
| 10 #include "ui/views/controls/button/custom_button.h" | 10 #include "ui/views/controls/button/custom_button.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 class ImageButton; | 13 class ImageButton; |
| 14 class ImageView; | 14 class ImageView; |
| 15 class Label; | 15 class Label; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace message_center { | 18 namespace message_center { |
| 19 | 19 |
| 20 class NotificationHeaderView : public views::CustomButton { | 20 class NotificationHeaderView : public views::CustomButton { |
| 21 public: | 21 public: |
| 22 NotificationHeaderView(views::ButtonListener* listener); | 22 NotificationHeaderView(views::ButtonListener* listener); |
| 23 void SetAppIcon(const gfx::ImageSkia& img); | 23 void SetAppIcon(const gfx::ImageSkia& img); |
| 24 void SetAppName(const base::string16& name); | 24 void SetAppName(const base::string16& name); |
| 25 void SetProgress(int progress); | 25 void SetProgress(int progress); |
| 26 void SetOverflowIndicator(int count); | 26 void SetOverflowIndicator(int count); |
| 27 void SetTimestamp(base::Time past); |
| 27 void SetExpandButtonEnabled(bool enabled); | 28 void SetExpandButtonEnabled(bool enabled); |
| 28 void SetExpanded(bool expanded); | 29 void SetExpanded(bool expanded); |
| 29 void SetSettingsButtonEnabled(bool enabled); | 30 void SetSettingsButtonEnabled(bool enabled); |
| 30 void SetCloseButtonEnabled(bool enabled); | 31 void SetCloseButtonEnabled(bool enabled); |
| 31 void SetControlButtonsVisible(bool visible); | 32 void SetControlButtonsVisible(bool visible); |
| 32 void ClearProgress(); | 33 void ClearProgress(); |
| 33 void ClearOverflowIndicator(); | 34 void ClearOverflowIndicator(); |
| 35 void ClearTimestamp(); |
| 34 bool IsExpandButtonEnabled(); | 36 bool IsExpandButtonEnabled(); |
| 35 bool IsSettingsButtonEnabled(); | 37 bool IsSettingsButtonEnabled(); |
| 36 bool IsCloseButtonEnabled(); | 38 bool IsCloseButtonEnabled(); |
| 37 bool IsCloseButtonFocused(); | 39 bool IsCloseButtonFocused(); |
| 38 | 40 |
| 39 // CustomButton override: | 41 // CustomButton override: |
| 40 std::unique_ptr<views::InkDrop> CreateInkDrop() override; | 42 std::unique_ptr<views::InkDrop> CreateInkDrop() override; |
| 41 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 43 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 42 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 44 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 43 const override; | 45 const override; |
| 44 | 46 |
| 45 views::ImageView* expand_button() { return expand_button_; } | 47 views::ImageView* expand_button() { return expand_button_; } |
| 46 views::ImageButton* settings_button() { return settings_button_; } | 48 views::ImageButton* settings_button() { return settings_button_; } |
| 47 views::ImageButton* close_button() { return close_button_; } | 49 views::ImageButton* close_button() { return close_button_; } |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 void UpdateControlButtonsVisibility(); | 52 void UpdateControlButtonsVisibility(); |
| 53 // Update visibility for both |summary_text_view_| and |timestamp_view_|. |
| 51 void UpdateSummaryTextVisibility(); | 54 void UpdateSummaryTextVisibility(); |
| 52 | 55 |
| 53 views::Label* app_name_view_ = nullptr; | 56 views::Label* app_name_view_ = nullptr; |
| 54 views::Label* summary_text_divider_ = nullptr; | 57 views::Label* summary_text_divider_ = nullptr; |
| 55 views::Label* summary_text_view_ = nullptr; | 58 views::Label* summary_text_view_ = nullptr; |
| 59 views::Label* timestamp_divider_ = nullptr; |
| 60 views::Label* timestamp_view_ = nullptr; |
| 56 views::ImageView* app_icon_view_ = nullptr; | 61 views::ImageView* app_icon_view_ = nullptr; |
| 57 views::ImageView* expand_button_ = nullptr; | 62 views::ImageView* expand_button_ = nullptr; |
| 58 PaddedButton* settings_button_ = nullptr; | 63 PaddedButton* settings_button_ = nullptr; |
| 59 PaddedButton* close_button_ = nullptr; | 64 PaddedButton* close_button_ = nullptr; |
| 60 | 65 |
| 61 bool settings_button_enabled_ = false; | 66 bool settings_button_enabled_ = false; |
| 62 bool close_button_enabled_ = false; | 67 bool close_button_enabled_ = false; |
| 63 bool is_control_buttons_visible_ = false; | 68 bool is_control_buttons_visible_ = false; |
| 64 bool has_progress_ = false; | 69 bool has_progress_ = false; |
| 65 bool has_overflow_indicator_ = false; | 70 bool has_overflow_indicator_ = false; |
| 71 bool has_timestamp_ = false; |
| 66 | 72 |
| 67 DISALLOW_COPY_AND_ASSIGN(NotificationHeaderView); | 73 DISALLOW_COPY_AND_ASSIGN(NotificationHeaderView); |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 } // namespace message_center | 76 } // namespace message_center |
| 71 | 77 |
| 72 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_HEADER_VIEW_H_ | 78 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_HEADER_VIEW_H_ |
| OLD | NEW |