OLD | NEW |
---|---|
(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_ | |
msw
2012/07/24 23:41:55
nit: do these files belong in the toolbar subdir?
yefimt
2012/07/25 21:09:21
Not sure. wrench_menu.* is in this folder too.
I d
msw
2012/07/25 23:02:03
Ah, I made that recommendation too hastily, thinki
| |
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/base/models/menu_model.h" | |
msw
2012/07/24 23:41:55
nit: is this include necessary?
yefimt
2012/07/25 21:09:21
Done.
| |
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: | |
msw
2012/07/24 23:41:55
nit: Standardize terminology here with what you us
| |
44 virtual void ExecuteCommand(int id) OVERRIDE; | |
msw
2012/07/24 23:41:55
nit: Match OVERRIDE declaration visibility (public
yefimt
2012/07/25 21:09:21
As in other place I was asked by reviewer always m
tfarina
2012/07/26 02:37:54
Yes, please, keep it private! outside of the publi
| |
45 virtual views::Border* CreateMenuBorder() OVERRIDE; | |
46 virtual views::Background* CreateMenuBackground() OVERRIDE; | |
47 | |
48 // BrowserActionView::Delegate and DragController overrides: | |
msw
2012/07/24 23:41:55
nit: Please differentiate OVERRIDEs by declaration
yefimt
2012/07/25 21:09:21
I was asked lump them together :)
msw
2012/07/25 23:02:03
Okay, this is fine then.
| |
49 virtual int GetCurrentTabId() const OVERRIDE; | |
50 virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE; | |
51 virtual void OnBrowserActionVisibilityChanged() OVERRIDE; | |
52 virtual gfx::Size GetViewContentOffset() const OVERRIDE; | |
53 virtual void WriteDragDataForView(views::View* sender, | |
54 const gfx::Point& press_pt, | |
55 ui::OSExchangeData* data) OVERRIDE; | |
56 virtual int GetDragOperationsForView(views::View* sender, | |
57 const gfx::Point& p) OVERRIDE; | |
58 virtual bool CanStartDragForView(views::View* sender, | |
59 const gfx::Point& press_pt, | |
60 const gfx::Point& p) OVERRIDE; | |
61 | |
62 // NotificationObserver overrides: | |
63 virtual void Observe(int type, | |
64 const content::NotificationSource& source, | |
65 const content::NotificationDetails& details) OVERRIDE; | |
66 | |
67 // Creates bookmark menu item and adds it to menu, |next_id| is incremented. | |
msw
2012/07/24 23:41:55
grammar nit: consider "Adds a new bookmark menu it
yefimt
2012/07/25 21:09:21
Done.
| |
68 views::MenuItemView* AddBookmarkMenuItem(views::MenuItemView* parent, | |
69 int* next_id); | |
70 | |
71 // Populates |parent| with all the child menus in |model|. | |
msw
2012/07/24 23:41:55
nit: what's |parent| and |model|? old args? Please
yefimt
2012/07/25 21:09:21
Done.
| |
72 void PopulateMenu(); | |
73 | |
74 Browser* browser_; | |
75 | |
76 // The views menu. Owned by |menu_runner_|. | |
77 views::MenuItemView* root_; | |
78 | |
79 scoped_ptr<views::MenuRunner> menu_runner_; | |
80 | |
81 // The model that tracks the order of the toolbar icons. | |
82 ActionBoxMenuModel* model_; | |
83 | |
84 bool bookmark_item_state_; | |
msw
2012/07/24 23:41:55
nit: description?
yefimt
2012/07/25 21:09:21
Done.
| |
85 | |
86 ScopedVector<BrowserActionView> browser_action_views_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenu); | |
89 }; | |
90 | |
91 #endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_ | |
OLD | NEW |