| 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_SYSTEM_DATE_TRAY_DATE_H_ | |
| 6 #define ASH_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 views { | |
| 17 class Label; | |
| 18 } | |
| 19 | |
| 20 namespace ash { | |
| 21 class DateDefaultView; | |
| 22 #if defined(OS_CHROMEOS) | |
| 23 class SystemClockObserver; | |
| 24 #endif | |
| 25 | |
| 26 namespace tray { | |
| 27 class TimeView; | |
| 28 } | |
| 29 | |
| 30 // System tray item for the time and date. | |
| 31 class ASH_EXPORT TrayDate : public SystemTrayItem, public ClockObserver { | |
| 32 public: | |
| 33 enum ClockLayout { | |
| 34 HORIZONTAL_CLOCK, | |
| 35 VERTICAL_CLOCK, | |
| 36 }; | |
| 37 | |
| 38 enum DateAction { | |
| 39 NONE, | |
| 40 SET_SYSTEM_TIME, | |
| 41 SHOW_DATE_SETTINGS, | |
| 42 }; | |
| 43 | |
| 44 explicit TrayDate(SystemTray* system_tray); | |
| 45 ~TrayDate() override; | |
| 46 | |
| 47 // Returns view for help button if it is exists. Returns NULL otherwise. | |
| 48 views::View* GetHelpButtonView() const; | |
| 49 | |
| 50 const tray::TimeView* GetTimeTrayForTesting() const; | |
| 51 const DateDefaultView* GetDefaultViewForTesting() const; | |
| 52 views::View* CreateDefaultViewForTesting(LoginStatus status); | |
| 53 | |
| 54 private: | |
| 55 // Overridden from SystemTrayItem. | |
| 56 views::View* CreateTrayView(LoginStatus status) override; | |
| 57 views::View* CreateDefaultView(LoginStatus status) override; | |
| 58 views::View* CreateDetailedView(LoginStatus status) override; | |
| 59 void DestroyTrayView() override; | |
| 60 void DestroyDefaultView() override; | |
| 61 void DestroyDetailedView() override; | |
| 62 void UpdateAfterLoginStatusChange(LoginStatus status) override; | |
| 63 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; | |
| 64 | |
| 65 // Overridden from ClockObserver. | |
| 66 void OnDateFormatChanged() override; | |
| 67 void OnSystemClockTimeUpdated() override; | |
| 68 void OnSystemClockCanSetTimeChanged(bool can_set_time) override; | |
| 69 void Refresh() override; | |
| 70 | |
| 71 void SetupLabelForTimeTray(views::Label* label); | |
| 72 | |
| 73 tray::TimeView* time_tray_; | |
| 74 DateDefaultView* default_view_; | |
| 75 LoginStatus login_status_; | |
| 76 | |
| 77 #if defined(OS_CHROMEOS) | |
| 78 std::unique_ptr<SystemClockObserver> system_clock_observer_; | |
| 79 #endif | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(TrayDate); | |
| 82 }; | |
| 83 | |
| 84 } // namespace ash | |
| 85 | |
| 86 #endif // ASH_SYSTEM_DATE_TRAY_DATE_H_ | |
| OLD | NEW |