OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_DATE_TRAY_DATE_H_ | |
6 #define ASH_COMMON_SYSTEM_DATE_TRAY_DATE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "ash/common/login_status.h" | |
12 #include "ash/common/system/date/clock_observer.h" | |
13 #include "ash/common/system/tray/system_tray_item.h" | |
14 #include "base/macros.h" | |
15 | |
16 namespace ash { | |
17 class DateDefaultView; | |
18 class SystemClockObserver; | |
19 | |
20 namespace tray { | |
21 class TimeView; | |
22 } | |
23 | |
24 // System tray item for the time and date. | |
25 class ASH_EXPORT TrayDate : public SystemTrayItem, public ClockObserver { | |
26 public: | |
27 enum ClockLayout { | |
28 HORIZONTAL_CLOCK, | |
29 VERTICAL_CLOCK, | |
30 }; | |
31 | |
32 enum DateAction { | |
33 NONE, | |
34 SET_SYSTEM_TIME, | |
35 SHOW_DATE_SETTINGS, | |
36 }; | |
37 | |
38 explicit TrayDate(SystemTray* system_tray); | |
39 ~TrayDate() override; | |
40 | |
41 // Returns view for help button if it is exists. Returns NULL otherwise. | |
42 views::View* GetHelpButtonView() const; | |
43 | |
44 const tray::TimeView* GetTimeTrayForTesting() const; | |
45 const DateDefaultView* GetDefaultViewForTesting() const; | |
46 views::View* CreateDefaultViewForTesting(LoginStatus status); | |
47 | |
48 private: | |
49 // Overridden from SystemTrayItem. | |
50 views::View* CreateTrayView(LoginStatus status) override; | |
51 views::View* CreateDefaultView(LoginStatus status) override; | |
52 views::View* CreateDetailedView(LoginStatus status) override; | |
53 void DestroyTrayView() override; | |
54 void DestroyDefaultView() override; | |
55 void DestroyDetailedView() override; | |
56 void UpdateAfterLoginStatusChange(LoginStatus status) override; | |
57 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; | |
58 | |
59 // Overridden from ClockObserver. | |
60 void OnDateFormatChanged() override; | |
61 void OnSystemClockTimeUpdated() override; | |
62 void OnSystemClockCanSetTimeChanged(bool can_set_time) override; | |
63 void Refresh() override; | |
64 | |
65 tray::TimeView* time_tray_; | |
66 DateDefaultView* default_view_; | |
67 LoginStatus login_status_; | |
68 | |
69 std::unique_ptr<SystemClockObserver> system_clock_observer_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(TrayDate); | |
72 }; | |
73 | |
74 } // namespace ash | |
75 | |
76 #endif // ASH_COMMON_SYSTEM_DATE_TRAY_DATE_H_ | |
OLD | NEW |