Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: chrome/browser/ui/gtk/throbber_gtk.h

Issue 9837011: [Web Intents] CWS inline install for GTK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..2ba03b1678c8d4bde064ceaee4c7dcf5004666ec
--- /dev/null
+++ b/chrome/browser/ui/gtk/throbber_gtk.h
@@ -0,0 +1,75 @@
+// 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,
+ public content::NotificationObserver {
+ public:
+ // |theme_service| must not be NULL.
+ explicit ThrobberGtk(ThemeServiceGtk* theme_service);
+ 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. Weak pointer.
+ ThemeServiceGtk* theme_service_;
+
+ // The actual GtkWidget.
+ ui::OwnedWidgetGtk widget_;
+
+ // A linear animation over the loaded frames.
+ ui::SlideAnimation animation_;
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698