cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ash / system / tray / system_tray_bubble.h
blobece879c3b4d6a4e5a0579b3f734bc21f1b22a4bc
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.
5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_
8 #include "ash/system/user/login_status.h"
9 #include "base/base_export.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/timer/timer.h"
12 #include "ui/views/bubble/tray_bubble_view.h"
14 #include <vector>
16 namespace ash {
17 class SystemTray;
18 class SystemTrayItem;
20 class SystemTrayBubble {
21 public:
22 enum BubbleType {
23 BUBBLE_TYPE_DEFAULT,
24 BUBBLE_TYPE_DETAILED,
25 BUBBLE_TYPE_NOTIFICATION
28 SystemTrayBubble(ash::SystemTray* tray,
29 const std::vector<ash::SystemTrayItem*>& items,
30 BubbleType bubble_type);
31 virtual ~SystemTrayBubble();
33 // Change the items displayed in the bubble.
34 void UpdateView(const std::vector<ash::SystemTrayItem*>& items,
35 BubbleType bubble_type);
37 // Creates |bubble_view_| and a child views for each member of |items_|.
38 // Also creates |bubble_wrapper_|. |init_params| may be modified.
39 void InitView(views::View* anchor,
40 user::LoginStatus login_status,
41 views::TrayBubbleView::InitParams* init_params);
43 // Focus the default item if no item is focused. Othewise, do nothing.
44 void FocusDefaultIfNeeded();
46 BubbleType bubble_type() const { return bubble_type_; }
47 views::TrayBubbleView* bubble_view() const { return bubble_view_; }
49 void DestroyItemViews();
50 void BubbleViewDestroyed();
51 void StartAutoCloseTimer(int seconds);
52 void StopAutoCloseTimer();
53 void RestartAutoCloseTimer();
54 void Close();
55 void SetVisible(bool is_visible);
56 bool IsVisible();
58 // Returns true if any of the SystemTrayItems return true from
59 // ShouldShowShelf().
60 bool ShouldShowShelf() const;
62 private:
63 void CreateItemViews(user::LoginStatus login_status);
65 ash::SystemTray* tray_;
66 views::TrayBubbleView* bubble_view_;
67 std::vector<ash::SystemTrayItem*> items_;
68 BubbleType bubble_type_;
70 int autoclose_delay_;
71 base::OneShotTimer<SystemTrayBubble> autoclose_;
73 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble);
76 } // namespace ash
78 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_