Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ui/message_center/views/notification_control_buttons_view.h

Issue 2960333003: Extract the view of control buttons on notification into a separated class (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/gfx/geometry/vector2d.h"
yhanada 2017/06/29 04:14:47 Is this needed?
yoshiki 2017/06/29 06:29:42 Removed.
9 #include "ui/message_center/message_center_export.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/view.h"
12
13 namespace ui {
14 class Event;
15 }
16
17 namespace gfx {
18 class LinearAnimation;
19 }
20
21 namespace message_center {
22
23 class MessageView;
24 class PaddedButton;
25
26 class MESSAGE_CENTER_EXPORT NotificationControlButtonsView
27 : public views::View,
28 public views::ButtonListener,
29 public gfx::AnimationDelegate {
30 public:
31 // String to be returned by GetClassName() method.
32 static const char kViewClassName[];
33
34 explicit NotificationControlButtonsView(MessageView* message_view);
35 ~NotificationControlButtonsView() override;
36
37 // Change the visibility of the close button. True to show, false to hide.
38 void ShowCloseButton(bool show);
39 // Change the visibility of the settings button. True to show, false to hide.
40 void ShowSettingsButton(bool show);
41
42 // Set the background color of the view.
43 void SetBackgroundColor(const SkColor& target_bgcolor);
44
45 // Request the focus on the close button.
46 void RequestFocusOnCloseButton();
47
48 // Return the focus status of the close button. True if the focus is on the
49 // close button, false otherwise.
50 bool IsCloseButtonFocused() const;
51 // Return the focus status of the settings button. True if the focus is on the
52 // close button, false otherwise.
53 bool IsSettingsButtonFocused() const;
54
55 message_center::PaddedButton* close_button_for_testing() const {
56 return close_button_;
57 }
58 message_center::PaddedButton* settings_button_for_testing() const {
59 return settings_button_;
60 }
61
62 // views::View
63 const char* GetClassName() const override;
64
65 // views::ButtonListener
66 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
67
68 // gfx::AnimationDelegate
69 void AnimationEnded(const gfx::Animation* animation) override;
70 void AnimationProgressed(const gfx::Animation* animation) override;
71 void AnimationCanceled(const gfx::Animation* animation) override;
72
73 private:
74 MessageView* message_view_;
75
76 message_center::PaddedButton* close_button_ = nullptr;
77 message_center::PaddedButton* settings_button_ = nullptr;
78
79 std::unique_ptr<gfx::LinearAnimation> bgcolor_animation_;
80 SkColor bgcolor_origin_;
81 SkColor bgcolor_target_;
82
83 DISALLOW_COPY_AND_ASSIGN(NotificationControlButtonsView);
84 };
85
86 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698