summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/browser_actions_container.h
diff options
context:
space:
mode:
authorerikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 20:19:20 +0000
committererikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 20:19:20 +0000
commit2d8d923da42df61e9d65942945456d4b9304ef8e (patch)
tree21150546eca2423887f1cca5f9fe7a58ef08224a /chrome/browser/views/browser_actions_container.h
parent9e0dfa8ae69f71441d62f725441f7075f791bd09 (diff)
downloadchromium_src-2d8d923da42df61e9d65942945456d4b9304ef8e.zip
chromium_src-2d8d923da42df61e9d65942945456d4b9304ef8e.tar.gz
chromium_src-2d8d923da42df61e9d65942945456d4b9304ef8e.tar.bz2
Add simple popup support to browser actions. This will create a popup HTML window that extends below a browser action button when the browser is clicked. When it loses focus, it is automatically dismissed.
BUG=23596 TEST=none Review URL: http://codereview.chromium.org/258011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/browser_actions_container.h')
-rw-r--r--chrome/browser/views/browser_actions_container.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h
index fd83437..178a3a2 100644
--- a/chrome/browser/views/browser_actions_container.h
+++ b/chrome/browser/views/browser_actions_container.h
@@ -7,15 +7,19 @@
#include <vector>
+#include "base/task.h"
+#include "chrome/browser/views/browser_bubble.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "views/view.h"
+class BrowserActionImageView;
class ExtensionAction;
+class ExtensionPopup;
class Profile;
class ToolbarView;
namespace views {
-class TextButton;
+class MenuButton;
}
////////////////////////////////////////////////////////////////////////////////
@@ -26,7 +30,8 @@ class TextButton;
//
////////////////////////////////////////////////////////////////////////////////
class BrowserActionsContainer : public views::View,
- public NotificationObserver {
+ public NotificationObserver,
+ public BrowserBubble::Delegate {
public:
BrowserActionsContainer(Profile* profile, ToolbarView* toolbar);
virtual ~BrowserActionsContainer();
@@ -43,7 +48,7 @@ class BrowserActionsContainer : public views::View,
void OnBrowserActionVisibilityChanged();
// Called when the user clicks on the browser action icon.
- void OnBrowserActionExecuted(const ExtensionAction& browser_action);
+ void OnBrowserActionExecuted(BrowserActionImageView* button);
// Overridden from views::View:
virtual gfx::Size GetPreferredSize();
@@ -54,9 +59,18 @@ class BrowserActionsContainer : public views::View,
const NotificationSource& source,
const NotificationDetails& details);
+ // BrowserBubble::Delegate methods.
+ virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble);
+ virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble);
+ virtual void BubbleGotFocus(BrowserBubble* bubble);
+ virtual void BubbleLostFocus(BrowserBubble* bubble);
+
private:
+ // Hide the current popup.
+ void HidePopup();
+
// The vector of browser actions (icons/image buttons for each action).
- std::vector<views::TextButton*> browser_action_views_;
+ std::vector<views::MenuButton*> browser_action_views_;
NotificationRegistrar registrar_;
@@ -65,6 +79,15 @@ class BrowserActionsContainer : public views::View,
// The toolbar that owns us.
ToolbarView* toolbar_;
+ // The current popup and the button it came from. NULL if no popup.
+ ExtensionPopup* popup_;
+
+ // The button that triggered the current popup (just a reference to a button
+ // from browser_action_views_).
+ BrowserActionImageView* popup_button_;
+
+ ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
};