Chromium Code Reviews| Index: chrome/browser/ui/gtk/throbber_gtk.h |
| diff --git a/chrome/browser/ui/gtk/throbber_gtk.h b/chrome/browser/ui/gtk/throbber_gtk.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..090242ad24e11706dcd5cb2997fae3199c4c08da |
| --- /dev/null |
| +++ b/chrome/browser/ui/gtk/throbber_gtk.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_ |
| +#define CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_ |
| +#pragma once |
| + |
| +#include <gtk/gtk.h> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#include "ui/base/animation/animation_delegate.h" |
| +#include "ui/base/animation/slide_animation.h" |
| +#include "ui/base/gtk/gtk_signal.h" |
| +#include "ui/base/gtk/owned_widget_gtk.h" |
| +#include "ui/gfx/image/image.h" |
| + |
| +class SkBitmap; |
| +class ThemeServiceGtk; |
| + |
| +// An animating throbber. |
| +class ThrobberGtk : public ui::AnimationDelegate, |
|
James Hawkins
2012/03/30 21:35:02
This hasn't existed previously?
binji
2012/03/30 23:03:51
Not as a standalone widget, AFAICT.
|
| + public content::NotificationObserver { |
| + public: |
| + explicit ThrobberGtk(ThemeServiceGtk* theme_service); |
|
James Hawkins
2012/03/30 21:35:02
nit: Document |theme_service|. Probably must not
binji
2012/03/30 23:03:51
Done.
|
| + virtual ~ThrobberGtk(); |
| + |
| + // Start or stop the throbbing animation. |
| + void Start(); |
| + void Stop(); |
| + |
| + GtkWidget* widget() const { return widget_.get(); } |
| + |
| + // ui::AnimationDelegate implementation. |
| + virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| + virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| + |
| + // content::NotificationObserver implementation. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + private: |
| + CHROMEGTK_CALLBACK_1(ThrobberGtk, gboolean, OnExpose, GdkEventExpose*); |
| + |
| + // Initialize the widget. |
| + void Init(); |
| + |
| + // Load the animation frames from IDR_THROBBER. |
| + void LoadFrames(); |
| + |
| + content::NotificationRegistrar registrar_; |
| + |
| + // The theme service. |
|
James Hawkins
2012/03/30 21:35:02
Document ownership (probably weak pointer).
binji
2012/03/30 23:03:51
Done.
|
| + ThemeServiceGtk* theme_service_; |
| + |
| + // The actual GtkWidget. |
| + ui::OwnedWidgetGtk widget_; |
| + |
| + // A linear animation over the loaded frames. |
| + ui::SlideAnimation animation_; |
|
Evan Stade
2012/03/30 21:38:25
ThrobAnimation?
binji
2012/03/30 23:03:51
Tried that first, seems like it autoreverses.
Evan Stade
2012/03/31 01:24:35
in what way? it goes counter clockwise?
binji
2012/04/02 18:22:36
Yes. As I understand it, the ThrobAnimation is use
|
| + |
| + // The image containing the throbber frames. |
| + const gfx::Image* frames_; |
| + |
| + // The number of frames in |frames_|. |
| + int num_frames_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ThrobberGtk); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_GTK_THROBBER_GTK_H_ |