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.
5 #ifndef CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_GTK_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/extensions/extension_installed_bubble.h"
11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
12 #include "chrome/browser/ui/gtk/custom_button.h"
17 namespace extensions
{
21 // Provides feedback to the user upon successful installation of an
22 // extension. Depending on the type of extension, the BubbleGtk will
24 // OMNIBOX_KEYWORD-> The omnibox.
25 // BROWSER_ACTION -> The browserAction icon in the toolbar.
26 // PAGE_ACTION -> A preview of the page action icon in the location
27 // bar which is shown while the BubbleGtk is shown.
28 // GENERIC -> The wrench menu. This case includes page actions that
29 // don't specify a default icon.
31 // ExtensionInstallBubble manages its own lifetime.
32 class ExtensionInstalledBubbleGtk
33 : public ExtensionInstalledBubble::Delegate
,
34 public BubbleDelegateGtk
{
36 virtual ~ExtensionInstalledBubbleGtk();
38 // Creates the ExtensionInstalledBubble and schedules it to be shown once
39 // the extension has loaded. |extension| is the installed extension. |browser|
40 // is the browser window which will host the bubble. |icon| is the install
41 // icon of the extension.
42 static void Show(const extensions::Extension
* extension
,
44 const SkBitmap
& icon
);
47 ExtensionInstalledBubbleGtk(const extensions::Extension
* extension
,
49 const SkBitmap
& icon
);
51 // Notified when the bubble gets destroyed so we can delete our instance.
52 CHROMEGTK_CALLBACK_0(ExtensionInstalledBubbleGtk
, void, OnDestroy
);
54 // ExtensionInstalledBubble::Delegate:
55 virtual bool MaybeShowNow() OVERRIDE
;
58 virtual void BubbleClosing(BubbleGtk
* bubble
, bool closed_by_escape
) OVERRIDE
;
60 static void OnButtonClick(GtkWidget
* button
,
61 ExtensionInstalledBubbleGtk
* toolbar
);
63 // Link button callbacks.
64 CHROMEGTK_CALLBACK_0(ExtensionInstalledBubbleGtk
, void, OnLinkClicked
);
66 // The 'x' that the user can press to hide the bubble shelf.
67 scoped_ptr
<CustomDrawButton
> close_button_
;
69 ExtensionInstalledBubble bubble_
;
70 BubbleGtk
* gtk_bubble_
;
72 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleGtk
);
75 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_GTK_H_