forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia_notification_container_impl.h
77 lines (62 loc) · 2.95 KB
/
media_notification_container_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_MEDIA_MEDIA_NOTIFICATION_CONTAINER_IMPL_H_
#define ASH_MEDIA_MEDIA_NOTIFICATION_CONTAINER_IMPL_H_
#include "ash/ash_export.h"
#include "base/containers/flat_set.h"
#include "components/media_message_center/media_notification_container.h"
#include "ui/message_center/views/message_view.h"
namespace media_message_center {
class MediaSessionNotificationItem;
class MediaNotificationView;
} // namespace media_message_center
namespace ash {
// MediaNotificationContainerImpl will show up as a custom notification. It will
// show the currently playing media and provide playback controls. There will
// also be control buttons (e.g. close) in the top right corner that will hide
// and show if the notification is hovered.
class ASH_EXPORT MediaNotificationContainerImpl
: public message_center::MessageView,
public media_message_center::MediaNotificationContainer {
public:
explicit MediaNotificationContainerImpl(
const message_center::Notification& notification,
base::WeakPtr<media_message_center::MediaSessionNotificationItem> item);
~MediaNotificationContainerImpl() override;
// message_center::MessageView:
void UpdateWithNotification(
const message_center::Notification& notification) override;
message_center::NotificationControlButtonsView* GetControlButtonsView()
const override;
void SetExpanded(bool expanded) override;
void UpdateCornerRadius(int top_radius, int bottom_radius) override;
void UpdateControlButtonsVisibility() override;
// media_message_center::MediaNotificationContainer:
void OnExpanded(bool expanded) override;
void OnMediaSessionInfoChanged(
const media_session::mojom::MediaSessionInfoPtr& session_info) override {}
void OnMediaSessionMetadataChanged(
const media_session::MediaMetadata& metadata) override {}
void OnVisibleActionsChanged(
const base::flat_set<media_session::mojom::MediaSessionAction>& actions)
override {}
void OnMediaArtworkChanged(const gfx::ImageSkia& image) override {}
void OnColorsChanged(SkColor foreground, SkColor background) override;
void OnHeaderClicked() override {}
// views::View:
void OnMouseEvent(ui::MouseEvent* event) override;
private:
void UpdateControlButtonsVisibilityWithNotification(
const message_center::Notification& notification);
// Contains |control_buttons_view_| and puts a circular colored background
// behind it to ensure proper contrast.
views::View* control_buttons_container_ = nullptr;
// View containing close and settings buttons.
message_center::NotificationControlButtonsView* control_buttons_view_ =
nullptr;
media_message_center::MediaNotificationView* view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(MediaNotificationContainerImpl);
};
} // namespace ash
#endif // ASH_MEDIA_MEDIA_NOTIFICATION_CONTAINER_IMPL_H_