Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ash / system / tray / throbber_view.h
blob4297df48129428113f60f1c9a5f9ab0f06cc76ef
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.
5 #ifndef ASH_SYSTEM_TRAY_THROBBER_VIEW_H_
6 #define ASH_SYSTEM_TRAY_THROBBER_VIEW_H_
8 #include "ui/gfx/size.h"
9 #include "ui/views/controls/throbber.h"
10 #include "ui/views/view.h"
12 namespace ash {
13 namespace internal {
15 // A SmoothedThrobber with tooltip.
16 class SystemTrayThrobber : public views::SmoothedThrobber {
17 public:
18 SystemTrayThrobber(int frame_delay_ms);
19 virtual ~SystemTrayThrobber();
21 void SetTooltipText(const string16& tooltip_text);
23 // Overriden from views::View.
24 virtual bool GetTooltipText(
25 const gfx::Point& p, string16* tooltip) const OVERRIDE;
27 private:
28 // The current tooltip text.
29 string16 tooltip_text_;
31 DISALLOW_COPY_AND_ASSIGN(SystemTrayThrobber);
34 // A View containing a SystemTrayThrobber with animation for starting/stopping.
35 class ThrobberView : public views::View {
36 public:
37 ThrobberView();
38 virtual ~ThrobberView();
40 void Start();
41 void Stop();
42 void SetTooltipText(const string16& tooltip_text);
44 // Overriden from views::View.
45 virtual gfx::Size GetPreferredSize() OVERRIDE;
46 virtual void Layout() OVERRIDE;
47 virtual bool GetTooltipText(
48 const gfx::Point& p, string16* tooltip) const OVERRIDE;
50 private:
51 // Schedules animation for starting/stopping throbber.
52 void ScheduleAnimation(bool start_throbber);
54 SystemTrayThrobber* throbber_;
56 // The current tooltip text.
57 string16 tooltip_text_;
59 DISALLOW_COPY_AND_ASSIGN(ThrobberView);
62 } // namespace internal
63 } // namespace ash
65 #endif // ASH_SYSTEM_TRAY_THROBBER_VIEW_H_