| OLD | NEW | 
|---|
|  | (Empty) | 
| 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. |  | 
| 4 |  | 
| 5 #ifndef CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_ |  | 
| 6 #define CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_ |  | 
| 7 |  | 
| 8 #include <gtk/gtk.h> |  | 
| 9 |  | 
| 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" |  | 
| 18 |  | 
| 19 class GtkThemeService; |  | 
| 20 class SkBitmap; |  | 
| 21 |  | 
| 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(); |  | 
| 29 |  | 
| 30   // Start or stop the throbbing animation. |  | 
| 31   void Start(); |  | 
| 32   void Stop(); |  | 
| 33 |  | 
| 34   GtkWidget* widget() const { return widget_.get(); } |  | 
| 35 |  | 
| 36   // gfx::AnimationDelegate implementation. |  | 
| 37   virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |  | 
| 38   virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |  | 
| 39 |  | 
| 40   // content::NotificationObserver implementation. |  | 
| 41   virtual void Observe(int type, |  | 
| 42                        const content::NotificationSource& source, |  | 
| 43                        const content::NotificationDetails& details) OVERRIDE; |  | 
| 44 |  | 
| 45  private: |  | 
| 46   CHROMEGTK_CALLBACK_1(ThrobberGtk, gboolean, OnExpose, GdkEventExpose*); |  | 
| 47 |  | 
| 48   // Initialize the widget. |  | 
| 49   void Init(); |  | 
| 50 |  | 
| 51   // Load the animation frames from IDR_THROBBER. |  | 
| 52   void LoadFrames(); |  | 
| 53 |  | 
| 54   content::NotificationRegistrar registrar_; |  | 
| 55 |  | 
| 56   // The theme service. Weak pointer. |  | 
| 57   GtkThemeService* theme_service_; |  | 
| 58 |  | 
| 59   // The actual GtkWidget. |  | 
| 60   ui::OwnedWidgetGtk widget_; |  | 
| 61 |  | 
| 62   // A linear animation over the loaded frames. |  | 
| 63   gfx::SlideAnimation animation_; |  | 
| 64 |  | 
| 65   // The image containing the throbber frames. |  | 
| 66   gfx::Image frames_; |  | 
| 67 |  | 
| 68   // The number of frames in |frames_|. |  | 
| 69   int num_frames_; |  | 
| 70 |  | 
| 71   DISALLOW_COPY_AND_ASSIGN(ThrobberGtk); |  | 
| 72 }; |  | 
| 73 |  | 
| 74 #endif  // CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_ |  | 
| OLD | NEW | 
|---|