Home | History | Annotate | Download | only in gtk
      1 // Copyright (c) 2011 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_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
      6 #define CHROME_BROWSER_UI_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
      7 #pragma once
      8 
      9 #include <gtk/gtk.h>
     10 
     11 #include "base/basictypes.h"
     12 #include "content/common/notification_observer.h"
     13 #include "content/common/notification_registrar.h"
     14 #include "ui/base/gtk/gtk_signal.h"
     15 
     16 class ThemeInstallBubbleViewGtk : public NotificationObserver {
     17  public:
     18   static void Show(GtkWindow* parent);
     19 
     20   // NotificationObserver implementation.
     21   virtual void Observe(NotificationType type,
     22                        const NotificationSource& source,
     23                        const NotificationDetails& details);
     24 
     25  private:
     26   explicit ThemeInstallBubbleViewGtk(GtkWidget* parent);
     27 
     28   virtual ~ThemeInstallBubbleViewGtk();
     29 
     30   void increment_num_loading() { num_loads_extant_++; }
     31 
     32   // Create the widget hierarchy.
     33   void InitWidgets();
     34 
     35   // Reposition |widget_| to be centered over |parent_|.
     36   void MoveWindow();
     37 
     38   // Our parent is going down; self destruct.
     39   CHROMEGTK_CALLBACK_0(ThemeInstallBubbleViewGtk, gboolean, OnUnmapEvent);
     40 
     41   // Draw the background. This is only signalled if we are using a compositing
     42   // window manager, otherwise we just use ActAsRoundedWindow().
     43   CHROMEGTK_CALLBACK_1(ThemeInstallBubbleViewGtk, gboolean,
     44                        OnExpose, GdkEventExpose*);
     45 
     46   GtkWidget* widget_;
     47 
     48   // The parent browser window, over which we position ourselves.
     49   GtkWidget* parent_;
     50 
     51   // The number of loads we represent. When it reaches 0 we delete ourselves.
     52   int num_loads_extant_;
     53 
     54   NotificationRegistrar registrar_;
     55 
     56   // Our one instance. We don't allow more than one to exist at a time.
     57   static ThemeInstallBubbleViewGtk* instance_;
     58 
     59   DISALLOW_COPY_AND_ASSIGN(ThemeInstallBubbleViewGtk);
     60 };
     61 
     62 #endif  // CHROME_BROWSER_UI_GTK_THEME_INSTALL_BUBBLE_VIEW_GTK_H_
     63