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

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, 5 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/linked_ptr.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/views/browser_action_view.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "ui/base/models/menu_model.h"
15 #include "ui/views/controls/menu/menu_delegate.h"
16
17 class ActionBoxMenuModel;
18
19 namespace views {
20 class Background;
21 class Border;
22 class MenuItemView;
23 class MenuRunner;
24 class View;
25 }
26
27 // ActionBoxMenu adapts the ActionBoxMenuModel to view's menu related classes.
28 class ActionBoxMenu : public views::MenuDelegate,
29 public BrowserActionView::Delegate,
30 public content::NotificationObserver {
31 public:
32 ActionBoxMenu(Browser* browser,
33 ActionBoxMenuModel* model,
34 bool bookmark_item_state);
35 virtual ~ActionBoxMenu();
36
37 void Init();
38
39 // Shows the menu relative to the specified button.
40 void RunMenu(views::MenuButton* menu_button);
41
42 private:
43 // MenuDelegate overrides:
44 virtual void ExecuteCommand(int id) OVERRIDE;
45 virtual views::Border* CreateMenuBorder() OVERRIDE;
46 virtual views::Background* CreateMenuBackground() OVERRIDE;
47
48 // BrowserActionsHostDelegate overrides:
Peter Kasting 2012/07/18 01:37:25 Nit: Is this supposed to refer to BroweserActionVi
yefimt 2012/07/18 23:18:13 Done.
49 virtual Browser* GetBrowser() const OVERRIDE;
50 virtual int GetCurrentTabId() const OVERRIDE;
51 virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
52 virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
53 virtual gfx::Size GetViewContentOffset() const OVERRIDE;
54
55 // DragController overrides:
Peter Kasting 2012/07/18 01:37:25 Nit: Lump these with the delegate overrides above
yefimt 2012/07/18 23:18:13 Done.
56 virtual void WriteDragDataForView(views::View* sender,
57 const gfx::Point& press_pt,
58 ui::OSExchangeData* data) OVERRIDE;
59 virtual int GetDragOperationsForView(views::View* sender,
60 const gfx::Point& p) OVERRIDE;
61 virtual bool CanStartDragForView(views::View* sender,
62 const gfx::Point& press_pt,
63 const gfx::Point& p) OVERRIDE;
64
65 // NotificationObserver overrides:
66 virtual void Observe(int type,
67 const content::NotificationSource& source,
68 const content::NotificationDetails& details) OVERRIDE;
69
70 views::MenuItemView* AddBookmarkMenuItem(views::MenuItemView* parent,
Peter Kasting 2012/07/18 01:37:25 Nit: Comment this, in particular what happens to t
yefimt 2012/07/18 23:18:13 Done.
71 int* next_id);
72
73 // Populates |parent| with all the child menus in |model|.
74 void PopulateMenu();
75
76 Browser* browser_;
77
78 // The views menu. Owned by |menu_runner_|.
79 views::MenuItemView* root_;
80
81 scoped_ptr<views::MenuRunner> menu_runner_;
82
83 // The model that tracks the order of the toolbar icons.
84 ActionBoxMenuModel* model_;
85
86 bool bookmark_item_state_;
87
88 typedef std::vector<linked_ptr<BrowserActionView> > BrowserActionViews;
Peter Kasting 2012/07/18 01:37:25 As noted, this should be converted to ScopedVector
yefimt 2012/07/18 23:18:13 Done.
89 BrowserActionViews browser_action_views_;
90
91 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenu);
92 };
93
94 #endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698