OLD | NEW |
| (Empty) |
1 // Copyright 2013 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_DRIVE_TRAY_DRIVE_NOTICE_H_ | |
6 #define ASH_SYSTEM_DRIVE_TRAY_DRIVE_NOTICE_H_ | |
7 | |
8 #include "ash/system/drive/drive_observer.h" | |
9 #include "ash/system/tray/tray_image_item.h" | |
10 #include "ash/system/tray/tray_item_more.h" | |
11 #include "base/timer/timer.h" | |
12 | |
13 namespace ash { | |
14 namespace internal { | |
15 | |
16 class DriveNoticeDetailedView; | |
17 | |
18 // A tray item shown to the user as a notice that Google Drive offline mode has | |
19 // been enabled automatically. This tray item is mainly informational and is | |
20 // automatically dismissed after a short period of time. | |
21 class ASH_EXPORT TrayDriveNotice : public TrayImageItem, | |
22 public DriveObserver { | |
23 public: | |
24 explicit TrayDriveNotice(SystemTray* system_tray); | |
25 virtual ~TrayDriveNotice(); | |
26 | |
27 views::View* GetTrayView(); | |
28 views::View* default_view() { return default_view_; } | |
29 views::View* detailed_view() { return detailed_view_; } | |
30 | |
31 // Set the time the tray item is visible after opting-in for testing. | |
32 void SetTimeVisibleForTest(int time_visible_secs); | |
33 | |
34 private: | |
35 void HideNotice(); | |
36 | |
37 // Overridden from TrayImageItem. | |
38 virtual bool GetInitialVisibility() OVERRIDE; | |
39 | |
40 // Overridden from SystemTrayItem. | |
41 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | |
42 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; | |
43 virtual void DestroyDefaultView() OVERRIDE; | |
44 virtual void DestroyDetailedView() OVERRIDE; | |
45 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; | |
46 | |
47 // Overridden from DriveObserver. | |
48 virtual void OnDriveJobUpdated(const DriveOperationStatus& status) OVERRIDE; | |
49 virtual void OnDriveOfflineEnabled() OVERRIDE; | |
50 | |
51 views::View* default_view_; | |
52 views::View* detailed_view_; | |
53 base::OneShotTimer<TrayDriveNotice> visibility_timer_; | |
54 bool showing_item_; | |
55 int time_visible_secs_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(TrayDriveNotice); | |
58 }; | |
59 | |
60 } // namespace internal | |
61 } // namespace ash | |
62 | |
63 #endif // ASH_SYSTEM_DRIVE_TRAY_DRIVE_NOTICE_H_ | |
OLD | NEW |