Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / throbber_gtk.h
blobfd03bdec8f40dbe3c6c000920332a9b50569b163
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 CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_
8 #include <gtk/gtk.h>
10 #include "base/compiler_specific.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13 #include "ui/base/gtk/gtk_signal.h"
14 #include "ui/base/gtk/owned_widget_gtk.h"
15 #include "ui/gfx/animation/animation_delegate.h"
16 #include "ui/gfx/animation/slide_animation.h"
17 #include "ui/gfx/image/image.h"
19 class GtkThemeService;
20 class SkBitmap;
22 // An animating throbber.
23 class ThrobberGtk : public gfx::AnimationDelegate,
24 public content::NotificationObserver {
25 public:
26 // |theme_service| must not be NULL.
27 explicit ThrobberGtk(GtkThemeService* theme_service);
28 virtual ~ThrobberGtk();
30 // Start or stop the throbbing animation.
31 void Start();
32 void Stop();
34 GtkWidget* widget() const { return widget_.get(); }
36 // gfx::AnimationDelegate implementation.
37 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
38 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
40 // content::NotificationObserver implementation.
41 virtual void Observe(int type,
42 const content::NotificationSource& source,
43 const content::NotificationDetails& details) OVERRIDE;
45 private:
46 CHROMEGTK_CALLBACK_1(ThrobberGtk, gboolean, OnExpose, GdkEventExpose*);
48 // Initialize the widget.
49 void Init();
51 // Load the animation frames from IDR_THROBBER.
52 void LoadFrames();
54 content::NotificationRegistrar registrar_;
56 // The theme service. Weak pointer.
57 GtkThemeService* theme_service_;
59 // The actual GtkWidget.
60 ui::OwnedWidgetGtk widget_;
62 // A linear animation over the loaded frames.
63 gfx::SlideAnimation animation_;
65 // The image containing the throbber frames.
66 gfx::Image frames_;
68 // The number of frames in |frames_|.
69 int num_frames_;
71 DISALLOW_COPY_AND_ASSIGN(ThrobberGtk);
74 #endif // CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_