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

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: Created 8 years, 6 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 #pragma once
8
9 #include <map>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/views/browser_actions_host_delegate.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 class BrowserActionView;
19
20 namespace views {
21 class MenuRunner;
22 class View;
23 }
24
25 namespace gfx {
26 class Size;
27 }
28
29 // ActionBoxMenu adapts the ActionBoxMenuModel to view's menu related classes.
30 class ActionBoxMenu
31 : public views::MenuDelegate,
32 public BrowserActionsHostDelegate,
33 public content::NotificationObserver {
34 public:
35 ActionBoxMenu(Browser* browser, ActionBoxMenuModel* model,
36 bool bookmark_item_state);
37 virtual ~ActionBoxMenu();
38
39 void Init();
Aaron Boodman 2012/06/12 05:53:44 Make private.
yefimt 2012/06/13 01:24:21 It is called from ActionBoxButtonView. Potentially
40
41 // Shows the menu relative to the specified view.
42 void RunMenu(views::MenuButton* host);
43
44 // BrowserActionsHostDelegate overrides:
Aaron Boodman 2012/06/12 05:53:44 Make these private.
yefimt 2012/06/13 01:24:21 Done.
45 virtual Browser* GetBrowser() const OVERRIDE;
46 virtual int GetCurrentTabId() const OVERRIDE;
47 virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
48 virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
49 virtual gfx::Size GetContentOffset() const OVERRIDE;
50
51 // Overridden from views::DragController:
52 virtual void WriteDragDataForView(views::View* sender,
53 const gfx::Point& press_pt,
54 ui::OSExchangeData* data) OVERRIDE;
55 virtual int GetDragOperationsForView(views::View* sender,
56 const gfx::Point& p) OVERRIDE;
57 virtual bool CanStartDragForView(views::View* sender,
58 const gfx::Point& press_pt,
59 const gfx::Point& p) OVERRIDE;
60
61 // content::NotificationObserver overrides:
62 virtual void Observe(int type,
63 const content::NotificationSource& source,
64 const content::NotificationDetails& details) OVERRIDE;
65
66 private:
67 views::MenuItemView* AddBookmarkMenuItem(views::MenuItemView* parent,
68 int* index,
69 int* next_id);
70
71 // Populates |parent| with all the child menus in |model|. Recursively invokes
72 // |PopulateMenu| for any submenu. |next_id| is incremented for every menu
73 // that is created.
74 void PopulateMenu(views::MenuItemView* parent,
75 ActionBoxMenuModel* model,
76 int* next_id);
77
78 Browser* browser_;
79
80 // The views menu. Owned by |menu_runner_|.
81 views::MenuItemView* root_;
82
83 scoped_ptr<views::MenuRunner> menu_runner_;
84
85 // The model that tracks the order of the toolbar icons.
86 ActionBoxMenuModel* model_;
87
88 bool bookmark_item_state_;
89
90 int model_index_offset_;
91
92 typedef std::vector<BrowserActionView*> BrowserActionViews;
93 BrowserActionViews browser_action_views_;
94
95 // content::NotificationRegistrar registrar_;
96
97 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenu);
98 };
99
100 #endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698