Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / extensions / bundle_installed_bubble_gtk.h
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_EXTENSIONS_BUNDLE_INSTALLED_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_BUNDLE_INSTALLED_BUBBLE_GTK_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/bundle_installer.h"
11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
12 #include "chrome/browser/ui/gtk/custom_button.h"
13
14 class Browser;
15
16 // The GTK implementation of the bundle installed bubble. The bubble reports
17 // which extensions and apps installed or failed when the bundle install
18 // completes.
19 class BundleInstalledBubbleGtk
20     : public BubbleDelegateGtk,
21       public base::RefCounted<BundleInstalledBubbleGtk> {
22  public:
23   // Displays an installed bubble in the |browser| for the |bundle|.
24   BundleInstalledBubbleGtk(const extensions::BundleInstaller* bundle,
25                            Browser* browser);
26
27  private:
28   friend class base::RefCounted<BundleInstalledBubbleGtk>;
29
30   virtual ~BundleInstalledBubbleGtk();
31
32   // Assembles the content area of the bubble.
33   void ShowInternal(const extensions::BundleInstaller* bundle);
34
35   // The bubble lists the items that installed successfully and those that
36   // failed. This assembles the lists for items in the given |state|.
37   void InsertExtensionList(GtkWidget* parent,
38                            const extensions::BundleInstaller* bundle,
39                            extensions::BundleInstaller::Item::State state);
40
41   // BubbleDelegateGtk, called when the bubble is about to close.
42   virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
43
44   // Closes the bubble.
45   void Close();
46
47   // Called when the user clicks the bubble's close button.
48   static void OnButtonClick(GtkWidget* button,
49                             BundleInstalledBubbleGtk* bubble);
50
51   Browser* browser_;
52   scoped_ptr<CustomDrawButton> close_button_;
53   BubbleGtk* bubble_;
54
55   DISALLOW_COPY_AND_ASSIGN(BundleInstalledBubbleGtk);
56 };
57
58 #endif  // CHROME_BROWSER_UI_GTK_EXTENSIONS_BUNDLE_INSTALLED_BUBBLE_GTK_H_