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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_VIEWS_ACTION_BOX_MENU_H_
6 #define CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
7
8 #include <map>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "chrome/browser/ui/views/browser_action_view.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "ui/views/controls/menu/menu_delegate.h"
15
16 class ActionBoxMenuModel;
17
18 namespace views {
19 class Background;
20 class Border;
21 class MenuItemView;
22 class MenuRunner;
23 class View;
24 }
25
26 // ActionBoxMenu adapts the ActionBoxMenuModel to view's menu related classes.
27 class ActionBoxMenu : public views::MenuDelegate,
28 public BrowserActionView::Delegate,
29 public content::NotificationObserver {
30 public:
31 ActionBoxMenu(Browser* browser,
32 ActionBoxMenuModel* model,
33 bool starred);
34 virtual ~ActionBoxMenu();
35
36 void Init();
37
38 // Shows the menu relative to the specified button.
39 void RunMenu(views::MenuButton* menu_button);
40
41 private:
42 // Overridden from views::MenuDelegate:
43 virtual void ExecuteCommand(int id) OVERRIDE;
44 virtual views::Border* CreateMenuBorder() OVERRIDE;
45 virtual views::Background* CreateMenuBackground() OVERRIDE;
46
47 // Overridden from BrowserActionView::Delegate and DragController overrides:
48 virtual int GetCurrentTabId() const OVERRIDE;
49 virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
50 virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
51 virtual gfx::Point GetViewContentOffset() const OVERRIDE;
52 virtual bool NeedToShowMultipleIconStates() const OVERRIDE;
53 virtual bool NeedToShowTooltip() const OVERRIDE;
54 virtual void WriteDragDataForView(views::View* sender,
55 const gfx::Point& press_pt,
56 ui::OSExchangeData* data) OVERRIDE;
57 virtual int GetDragOperationsForView(views::View* sender,
58 const gfx::Point& p) OVERRIDE;
59 virtual bool CanStartDragForView(views::View* sender,
60 const gfx::Point& press_pt,
61 const gfx::Point& p) OVERRIDE;
62
63 // NotificationObserver overrides:
64 virtual void Observe(int type,
65 const content::NotificationSource& source,
66 const content::NotificationDetails& details) OVERRIDE;
67
68 // Adds a new bookmark menu item to the menu, |next_id| is incremented.
69 views::MenuItemView* AddBookmarkMenuItem(views::MenuItemView* parent,
70 int* next_id);
71
72 // Populates |root_| with all the child menu items from the |model_|.
73 void PopulateMenu();
74
75 Browser* browser_;
76
77 // The views menu. Owned by |menu_runner_|.
78 views::MenuItemView* root_;
79
80 scoped_ptr<views::MenuRunner> menu_runner_;
81
82 // The model that tracks the order of the toolbar icons.
83 ActionBoxMenuModel* model_;
84
85 // Set when the current page is bookmarked and thus the star icon should be
86 // drawn in the "starred" rather than "unstarred" state.
87 bool starred_;
88
89 ScopedVector<BrowserActionView> browser_action_views_;
90
91 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenu);
92 };
93
94 #endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
OLDNEW
« 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