diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 18:00:57 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 18:00:57 +0000 |
commit | 854dddc6b0f52545ab1008237630aa5472089080 (patch) | |
tree | 125bbb133628fdf6dde3a7ca5fac539b4d02a6b1 /chrome/browser/gtk/extension_popup_gtk.h | |
parent | 9912cd8c8bb8e89df4b33ba91c6c533e50132dca (diff) | |
download | chromium_src-854dddc6b0f52545ab1008237630aa5472089080.zip chromium_src-854dddc6b0f52545ab1008237630aa5472089080.tar.gz chromium_src-854dddc6b0f52545ab1008237630aa5472089080.tar.bz2 |
GTK: add browser actions popups.
Also add a new notification that tells the popup to close.
BUG=23897
TEST=--load-extension=chrome/test/data/extensions/samples/buildbot
TEST=--load-extension=chrome/test/data/extensions/samples/set_page_color
Review URL: http://codereview.chromium.org/314008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/extension_popup_gtk.h')
-rw-r--r-- | chrome/browser/gtk/extension_popup_gtk.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/chrome/browser/gtk/extension_popup_gtk.h b/chrome/browser/gtk/extension_popup_gtk.h new file mode 100644 index 0000000..58578c8 --- /dev/null +++ b/chrome/browser/gtk/extension_popup_gtk.h @@ -0,0 +1,63 @@ +// Copyright (c) 2009 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_GTK_EXTENSION_POPUP_GTK_H_ +#define CHROME_BROWSER_GTK_EXTENSION_POPUP_GTK_H_ + +#include "base/gfx/rect.h" +#include "base/scoped_ptr.h" +#include "chrome/browser/gtk/info_bubble_gtk.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" + +class Browser; +class ExtensionHost; +class GURL; + +class ExtensionPopupGtk : public NotificationObserver, + public InfoBubbleGtkDelegate { + public: + ExtensionPopupGtk(Browser* browser, + ExtensionHost* host, + const gfx::Rect& relative_to); + virtual ~ExtensionPopupGtk(); + + static void Show(const GURL& url, + Browser* browser, + const gfx::Rect& relative_to); + + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + // InfoBubbleGtkDelegate implementation. + virtual void InfoBubbleClosing(InfoBubbleGtk* bubble, + bool closed_by_escape); + + private: + // Shows the popup widget. Called after loading completes. + void ShowPopup(); + + // Destroys the popup widget. This will in turn destroy us since we delete + // ourselves when the info bubble closes. + void DestroyPopup(); + + Browser* browser_; + + InfoBubbleGtk* bubble_; + + // We take ownership of the popup ExtensionHost. + scoped_ptr<ExtensionHost> host_; + + // The rect that we use to position the popup. It is the bounds of the + // browser action button. + gfx::Rect relative_to_; + + NotificationRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk); +}; + +#endif // CHROME_BROWSER_GTK_EXTENSION_POPUP_GTK_H_ |