Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: chrome/browser/ui/views/action_box_menu.h

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/toolbar/action_box_menu_model.cc ('k') | chrome/browser/ui/views/action_box_menu.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/action_box_menu.h
diff --git a/chrome/browser/ui/views/action_box_menu.h b/chrome/browser/ui/views/action_box_menu.h
new file mode 100644
index 0000000000000000000000000000000000000000..c472435cf8300f5f4e9dc9f5aefa1bd9127af9a6
--- /dev/null
+++ b/chrome/browser/ui/views/action_box_menu.h
@@ -0,0 +1,94 @@
+// Copyright (c) 2012 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_UI_VIEWS_ACTION_BOX_MENU_H_
+#define CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
+
+#include <map>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "chrome/browser/ui/views/browser_action_view.h"
+#include "content/public/browser/notification_observer.h"
+#include "ui/views/controls/menu/menu_delegate.h"
+
+class ActionBoxMenuModel;
+
+namespace views {
+class Background;
+class Border;
+class MenuItemView;
+class MenuRunner;
+class View;
+}
+
+// ActionBoxMenu adapts the ActionBoxMenuModel to view's menu related classes.
+class ActionBoxMenu : public views::MenuDelegate,
+ public BrowserActionView::Delegate,
+ public content::NotificationObserver {
+ public:
+ ActionBoxMenu(Browser* browser,
+ ActionBoxMenuModel* model,
+ bool starred);
+ virtual ~ActionBoxMenu();
+
+ void Init();
+
+ // Shows the menu relative to the specified button.
+ void RunMenu(views::MenuButton* menu_button);
+
+ private:
+ // Overridden from views::MenuDelegate:
+ virtual void ExecuteCommand(int id) OVERRIDE;
+ virtual views::Border* CreateMenuBorder() OVERRIDE;
+ virtual views::Background* CreateMenuBackground() OVERRIDE;
+
+ // Overridden from BrowserActionView::Delegate and DragController overrides:
+ virtual int GetCurrentTabId() const OVERRIDE;
+ virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
+ virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
+ virtual gfx::Point GetViewContentOffset() const OVERRIDE;
+ virtual bool NeedToShowMultipleIconStates() const OVERRIDE;
+ virtual bool NeedToShowTooltip() const OVERRIDE;
+ virtual void WriteDragDataForView(views::View* sender,
+ const gfx::Point& press_pt,
+ ui::OSExchangeData* data) OVERRIDE;
+ virtual int GetDragOperationsForView(views::View* sender,
+ const gfx::Point& p) OVERRIDE;
+ virtual bool CanStartDragForView(views::View* sender,
+ const gfx::Point& press_pt,
+ const gfx::Point& p) OVERRIDE;
+
+ // NotificationObserver overrides:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // Adds a new bookmark menu item to the menu, |next_id| is incremented.
+ views::MenuItemView* AddBookmarkMenuItem(views::MenuItemView* parent,
+ int* next_id);
+
+ // Populates |root_| with all the child menu items from the |model_|.
+ void PopulateMenu();
+
+ Browser* browser_;
+
+ // The views menu. Owned by |menu_runner_|.
+ views::MenuItemView* root_;
+
+ scoped_ptr<views::MenuRunner> menu_runner_;
+
+ // The model that tracks the order of the toolbar icons.
+ ActionBoxMenuModel* model_;
+
+ // Set when the current page is bookmarked and thus the star icon should be
+ // drawn in the "starred" rather than "unstarred" state.
+ bool starred_;
+
+ ScopedVector<BrowserActionView> browser_action_views_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActionBoxMenu);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
« no previous file with comments | « chrome/browser/ui/toolbar/action_box_menu_model.cc ('k') | chrome/browser/ui/views/action_box_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698