1 // Copyright (c) 2012 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.
5 #ifndef ASH_SYSTEM_DATE_TRAY_DATE_H_
6 #define ASH_SYSTEM_DATE_TRAY_DATE_H_
8 #include "ash/ash_export.h"
9 #include "ash/system/date/clock_observer.h"
10 #include "ash/system/tray/system_tray_item.h"
11 #include "base/memory/scoped_ptr.h"
18 class DateDefaultView
;
19 #if defined(OS_CHROMEOS)
20 class SystemClockObserver
;
27 class ASH_EXPORT TrayDate
: public SystemTrayItem
, public ClockObserver
{
40 explicit TrayDate(SystemTray
* system_tray
);
43 // Returns view for help button if it is exists. Returns NULL otherwise.
44 views::View
* GetHelpButtonView() const;
46 const tray::TimeView
* GetTimeTrayForTesting() const;
47 const DateDefaultView
* GetDefaultViewForTesting() const;
48 views::View
* CreateDefaultViewForTesting(user::LoginStatus status
);
51 // Overridden from SystemTrayItem.
52 views::View
* CreateTrayView(user::LoginStatus status
) override
;
53 views::View
* CreateDefaultView(user::LoginStatus status
) override
;
54 views::View
* CreateDetailedView(user::LoginStatus status
) override
;
55 void DestroyTrayView() override
;
56 void DestroyDefaultView() override
;
57 void DestroyDetailedView() override
;
58 void UpdateAfterLoginStatusChange(user::LoginStatus status
) override
;
59 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment
) override
;
61 // Overridden from ClockObserver.
62 void OnDateFormatChanged() override
;
63 void OnSystemClockTimeUpdated() override
;
64 void OnSystemClockCanSetTimeChanged(bool can_set_time
) override
;
65 void Refresh() override
;
67 void SetupLabelForTimeTray(views::Label
* label
);
69 tray::TimeView
* time_tray_
;
70 DateDefaultView
* default_view_
;
71 user::LoginStatus login_status_
;
73 #if defined(OS_CHROMEOS)
74 scoped_ptr
<SystemClockObserver
> system_clock_observer_
;
77 DISALLOW_COPY_AND_ASSIGN(TrayDate
);
82 #endif // ASH_SYSTEM_DATE_TRAY_DATE_H_