Home | History | Annotate | Download | only in date
      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 "ash/system/date/clock_observer.h"
      9 #include "ash/system/tray/system_tray_item.h"
     10 #include "base/memory/scoped_ptr.h"
     11 
     12 namespace views {
     13 class Label;
     14 }
     15 
     16 namespace ash {
     17 namespace internal {
     18 
     19 #if defined(OS_CHROMEOS)
     20 class SystemClockObserver;
     21 #endif
     22 class DateDefaultView;
     23 
     24 namespace tray {
     25 class TimeView;
     26 }
     27 
     28 class TrayDate : public SystemTrayItem,
     29                  public ClockObserver {
     30  public:
     31   enum ClockLayout {
     32    HORIZONTAL_CLOCK,
     33    VERTICAL_CLOCK,
     34   };
     35   explicit TrayDate(SystemTray* system_tray);
     36   virtual ~TrayDate();
     37 
     38   // Returns view for help button if it is exists. Returns NULL otherwise.
     39   views::View* GetHelpButtonView() const;
     40 
     41  private:
     42   // Overridden from SystemTrayItem.
     43   virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE;
     44   virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
     45   virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
     46   virtual void DestroyTrayView() OVERRIDE;
     47   virtual void DestroyDefaultView() OVERRIDE;
     48   virtual void DestroyDetailedView() OVERRIDE;
     49   virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE;
     50   virtual void UpdateAfterShelfAlignmentChange(
     51       ShelfAlignment alignment) OVERRIDE;
     52 
     53   // Overridden from ClockObserver.
     54   virtual void OnDateFormatChanged() OVERRIDE;
     55   virtual void OnSystemClockTimeUpdated() OVERRIDE;
     56   virtual void Refresh() OVERRIDE;
     57 
     58   void SetupLabelForTimeTray(views::Label* label);
     59 
     60   tray::TimeView* time_tray_;
     61   DateDefaultView* default_view_;
     62 
     63 #if defined(OS_CHROMEOS)
     64   scoped_ptr<SystemClockObserver> system_clock_observer_;
     65 #endif
     66 
     67   DISALLOW_COPY_AND_ASSIGN(TrayDate);
     68 };
     69 
     70 }  // namespace internal
     71 }  // namespace ash
     72 
     73 #endif  // ASH_SYSTEM_DATE_TRAY_DATE_H_
     74