1c7a9d7592f3832ded5706e6fd0530694dafe9be
[platform/framework/web/crosswalk.git] / src / ash / system / tray / throbber_view.h
1 // Copyright (c) 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_TRAY_THROBBER_VIEW_H_
6 #define ASH_SYSTEM_TRAY_THROBBER_VIEW_H_
7
8 #include "ui/gfx/size.h"
9 #include "ui/views/controls/throbber.h"
10 #include "ui/views/view.h"
11
12 namespace ash {
13
14 // A SmoothedThrobber with tooltip.
15 class SystemTrayThrobber : public views::SmoothedThrobber {
16  public:
17   SystemTrayThrobber(int frame_delay_ms);
18   ~SystemTrayThrobber() override;
19
20   void SetTooltipText(const base::string16& tooltip_text);
21
22   // Overriden from views::View.
23   bool GetTooltipText(const gfx::Point& p,
24                       base::string16* tooltip) const override;
25
26  private:
27   // The current tooltip text.
28   base::string16 tooltip_text_;
29
30   DISALLOW_COPY_AND_ASSIGN(SystemTrayThrobber);
31 };
32
33 // A View containing a SystemTrayThrobber with animation for starting/stopping.
34 class ThrobberView : public views::View {
35  public:
36   ThrobberView();
37   ~ThrobberView() override;
38
39   void Start();
40   void Stop();
41   void SetTooltipText(const base::string16& tooltip_text);
42
43   // Overriden from views::View.
44   gfx::Size GetPreferredSize() const override;
45   void Layout() override;
46   bool GetTooltipText(const gfx::Point& p,
47                       base::string16* tooltip) const override;
48
49  private:
50   // Schedules animation for starting/stopping throbber.
51   void ScheduleAnimation(bool start_throbber);
52
53   SystemTrayThrobber* throbber_;
54
55   // The current tooltip text.
56   base::string16 tooltip_text_;
57
58   DISALLOW_COPY_AND_ASSIGN(ThrobberView);
59 };
60
61 }  // namespace ash
62
63 #endif  // ASH_SYSTEM_TRAY_THROBBER_VIEW_H_