| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/macros.h" |
| 6 #include "third_party/skia/include/core/SkColor.h" |
| 7 #include "ui/gfx/animation/animation_delegate.h" |
| 8 #include "ui/message_center/message_center_export.h" |
| 9 #include "ui/views/controls/button/button.h" |
| 10 #include "ui/views/view.h" |
| 11 |
| 12 namespace ui { |
| 13 class Event; |
| 14 } |
| 15 |
| 16 namespace gfx { |
| 17 class LinearAnimation; |
| 18 } |
| 19 |
| 20 namespace message_center { |
| 21 |
| 22 class MessageView; |
| 23 class PaddedButton; |
| 24 |
| 25 class MESSAGE_CENTER_EXPORT NotificationControlButtonsView |
| 26 : public views::View, |
| 27 public views::ButtonListener, |
| 28 public gfx::AnimationDelegate { |
| 29 public: |
| 30 // String to be returned by GetClassName() method. |
| 31 static const char kViewClassName[]; |
| 32 |
| 33 explicit NotificationControlButtonsView(MessageView* message_view); |
| 34 ~NotificationControlButtonsView() override; |
| 35 |
| 36 // Change the visibility of the close button. True to show, false to hide. |
| 37 void ShowCloseButton(bool show); |
| 38 // Change the visibility of the settings button. True to show, false to hide. |
| 39 void ShowSettingsButton(bool show); |
| 40 |
| 41 // Set the background color of the view. |
| 42 void SetBackgroundColor(const SkColor& target_bgcolor); |
| 43 |
| 44 // Request the focus on the close button. |
| 45 void RequestFocusOnCloseButton(); |
| 46 |
| 47 // Return the focus status of the close button. True if the focus is on the |
| 48 // close button, false otherwise. |
| 49 bool IsCloseButtonFocused() const; |
| 50 // Return the focus status of the settings button. True if the focus is on the |
| 51 // close button, false otherwise. |
| 52 bool IsSettingsButtonFocused() const; |
| 53 |
| 54 message_center::PaddedButton* close_button_for_testing() const { |
| 55 return close_button_; |
| 56 } |
| 57 message_center::PaddedButton* settings_button_for_testing() const { |
| 58 return settings_button_; |
| 59 } |
| 60 |
| 61 // views::View |
| 62 const char* GetClassName() const override; |
| 63 |
| 64 // views::ButtonListener |
| 65 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 66 |
| 67 // gfx::AnimationDelegate |
| 68 void AnimationEnded(const gfx::Animation* animation) override; |
| 69 void AnimationProgressed(const gfx::Animation* animation) override; |
| 70 void AnimationCanceled(const gfx::Animation* animation) override; |
| 71 |
| 72 private: |
| 73 MessageView* message_view_; |
| 74 |
| 75 message_center::PaddedButton* close_button_ = nullptr; |
| 76 message_center::PaddedButton* settings_button_ = nullptr; |
| 77 |
| 78 std::unique_ptr<gfx::LinearAnimation> bgcolor_animation_; |
| 79 SkColor bgcolor_origin_; |
| 80 SkColor bgcolor_target_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(NotificationControlButtonsView); |
| 83 }; |
| 84 |
| 85 } // namespace message_center |
| OLD | NEW |