OLD | NEW |
| (Empty) |
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_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_GTK_H_ | |
6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_GTK_H_ | |
7 | |
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" | |
13 | |
14 class Browser; | |
15 class SkBitmap; | |
16 | |
17 namespace extensions { | |
18 class Extension; | |
19 } | |
20 | |
21 // Provides feedback to the user upon successful installation of an | |
22 // extension. Depending on the type of extension, the BubbleGtk will | |
23 // point to: | |
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. | |
30 // | |
31 // ExtensionInstallBubble manages its own lifetime. | |
32 class ExtensionInstalledBubbleGtk | |
33 : public ExtensionInstalledBubble::Delegate, | |
34 public BubbleDelegateGtk { | |
35 public: | |
36 virtual ~ExtensionInstalledBubbleGtk(); | |
37 | |
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, | |
43 Browser* browser, | |
44 const SkBitmap& icon); | |
45 | |
46 private: | |
47 ExtensionInstalledBubbleGtk(const extensions::Extension* extension, | |
48 Browser* browser, | |
49 const SkBitmap& icon); | |
50 | |
51 // Notified when the bubble gets destroyed so we can delete our instance. | |
52 CHROMEGTK_CALLBACK_0(ExtensionInstalledBubbleGtk, void, OnDestroy); | |
53 | |
54 // ExtensionInstalledBubble::Delegate: | |
55 virtual bool MaybeShowNow() OVERRIDE; | |
56 | |
57 // BubbleDelegateGtk: | |
58 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | |
59 | |
60 static void OnButtonClick(GtkWidget* button, | |
61 ExtensionInstalledBubbleGtk* toolbar); | |
62 | |
63 // Link button callbacks. | |
64 CHROMEGTK_CALLBACK_0(ExtensionInstalledBubbleGtk, void, OnLinkClicked); | |
65 | |
66 // The 'x' that the user can press to hide the bubble shelf. | |
67 scoped_ptr<CustomDrawButton> close_button_; | |
68 | |
69 ExtensionInstalledBubble bubble_; | |
70 BubbleGtk* gtk_bubble_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleGtk); | |
73 }; | |
74 | |
75 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_GTK_H_ | |
OLD | NEW |