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
ash / system / notification_center / views / timestamp_view.h [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_NOTIFICATION_CENTER_VIEWS_TIMESTAMP_VIEW_H_
#define ASH_SYSTEM_NOTIFICATION_CENTER_VIEWS_TIMESTAMP_VIEW_H_
#include "ash/ash_export.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/label.h"
namespace ash {
// A label view which shows a timestamp. The label is automatically updated
// periodically.
class ASH_EXPORT TimestampView : public views::Label {
METADATA_HEADER(TimestampView, views::Label)
public:
TimestampView();
TimestampView(const TimestampView&) = delete;
TimestampView& operator=(const TimestampView&) = delete;
~TimestampView() override;
// Sets the base time used to determine the text to be displayed for this
// timestamp.
void SetTimestamp(base::Time timestamp);
private:
// Updates the currently displayed text that specifies the duration for this
// timestamp.
void UpdateTimestampText();
base::OneShotTimer timestamp_update_timer_;
base::Time timestamp_;
};
} // namespace ash
#endif // ASH_SYSTEM_NOTIFICATION_CENTER_VIEWS_TIMESTAMP_VIEW_H_