Chromium Code Reviews| Index: ash/system/chromeos/session/tray_session_length_limit.h |
| diff --git a/ash/system/chromeos/session/tray_session_length_limit.h b/ash/system/chromeos/session/tray_session_length_limit.h |
| index 1c9da1713659256d007e540081e98424c79af473..ce96874e9251031eb49656ee4fee909c3a0d265c 100644 |
| --- a/ash/system/chromeos/session/tray_session_length_limit.h |
| +++ b/ash/system/chromeos/session/tray_session_length_limit.h |
| @@ -7,9 +7,11 @@ |
| #include "ash/system/chromeos/session/session_length_limit_observer.h" |
| #include "ash/system/tray/system_tray_item.h" |
| +#include "ash/system/tray/view_click_listener.h" |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/strings/string16.h" |
| #include "base/time/time.h" |
| #include "base/timer/timer.h" |
| @@ -18,14 +20,13 @@ namespace test { |
| class TraySessionLengthLimitTest; |
|
bartfab (slow)
2014/05/05 13:45:04
Nit: This should not be needed anymore.
Thiemo Nagel
2014/05/05 14:48:41
It's required for kNotificationId.
|
| } |
| -namespace tray { |
| -class RemainingSessionTimeTrayView; |
| -} |
| +class LabelTrayView; |
| // Adds a countdown timer to the system tray if the session length is limited. |
| class ASH_EXPORT TraySessionLengthLimit : public SystemTrayItem, |
| - public SessionLengthLimitObserver { |
| - public: |
| + public SessionLengthLimitObserver, |
| + public ViewClickListener { |
| +public: |
| enum LimitState { |
| LIMIT_NONE, |
| LIMIT_SET, |
| @@ -36,15 +37,16 @@ class ASH_EXPORT TraySessionLengthLimit : public SystemTrayItem, |
| virtual ~TraySessionLengthLimit(); |
| // SystemTrayItem: |
| - virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; |
| - virtual void DestroyTrayView() OVERRIDE; |
| - virtual void UpdateAfterShelfAlignmentChange( |
| - ShelfAlignment alignment) OVERRIDE; |
| + virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
| + virtual void DestroyDefaultView() OVERRIDE; |
| // SessionLengthLimitObserver: |
| virtual void OnSessionStartTimeChanged() OVERRIDE; |
| virtual void OnSessionLengthLimitChanged() OVERRIDE; |
| + // ViewClickListener: |
| + virtual void OnViewClicked(views::View* sender) OVERRIDE; |
| + |
| LimitState GetLimitState() const; |
| base::TimeDelta GetRemainingSessionTime() const; |
| @@ -53,16 +55,30 @@ class ASH_EXPORT TraySessionLengthLimit : public SystemTrayItem, |
| static const char kNotificationId[]; |
| + // Called by the Timer in regular intervals and also by OnSession*Changed(). |
| void Update(); |
| - bool IsTrayViewVisibleForTest(); |
| + // Recalculate |limit_state_| and the message strings. |
| + void UpdateState(); |
| - tray::RemainingSessionTimeTrayView* tray_view_; |
| + // Update notifications and views using the message strings. |
| + void UpdateUI(); |
| + |
| + void UpdateNotification(); |
| + void UpdateTrayBubbleView(); |
| - LimitState limit_state_; |
| base::TimeTicks session_start_time_; |
| base::TimeDelta limit_; |
| base::TimeDelta remaining_session_time_; |
| + |
| + LimitState limit_state_; |
| + LimitState last_limit_state_; |
| + base::string16 notification_message_; |
| + base::string16 last_notification_message_; |
| + base::string16 tray_bubble_message_; |
| + base::string16 last_tray_bubble_message_; |
| + LabelTrayView* tray_bubble_view_; |
| + |
| scoped_ptr<base::RepeatingTimer<TraySessionLengthLimit> > timer_; |
| DISALLOW_COPY_AND_ASSIGN(TraySessionLengthLimit); |