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

Side by Side Diff: chrome/browser/ui/views/compact_nav/compact_options_bar.h

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 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) 2011 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_COMPACT_NAV_COMPACT_OPTIONS_BAR_H_
6 #define CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_OPTIONS_BAR_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/scoped_ptr.h"
11 #include "chrome/browser/command_updater.h"
12 #include "chrome/browser/ui/views/wrench_menu.h"
sky 2011/05/03 18:38:32 forward declare WrenchMenu
SteveT 2011/05/06 18:48:43 Done.
13 #include "ui/base/models/simple_menu_model.h"
14 #include "views/controls/button/button.h"
15 #include "views/controls/button/menu_button.h"
sky 2011/05/03 18:38:32 forward declare
SteveT 2011/05/06 18:48:43 Done.
16 #include "views/controls/menu/menu_wrapper.h"
sky 2011/05/03 18:38:32 do you need this?
SteveT 2011/05/06 18:48:43 No - just had to forward declare views::MenuListen
17 #include "views/controls/menu/view_menu_delegate.h"
18 #include "views/view.h"
19
20 class BrowserView;
21
22 // This class provides a small options bar that includes browser actions and
23 // the wrench menu button.
24 class CompactOptionsBar : public views::View,
25 public views::ViewMenuDelegate,
26 public ui::AcceleratorProvider,
27 public views::ButtonListener {
28 public:
29 explicit CompactOptionsBar(BrowserView* browser_view);
30 virtual ~CompactOptionsBar();
31
32 // Must be called before anything else, but after adding this view to the
33 // widget.
34 void Init();
35
36 // views::View overrides.
37 virtual gfx::Size GetPreferredSize();
sky 2011/05/03 18:38:32 OVERRIDE (and other places)
SteveT 2011/05/06 18:48:43 Done.
38 virtual void Layout();
39 virtual void OnPaint(gfx::Canvas* canvas);
40
41 // Overridden from views::MenuDelegate:
42 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE;
43
44 // Add a listener to receive a callback when the menu opens.
sky 2011/05/03 18:38:32 Generally all overriden methods are last in a sect
SteveT 2011/05/06 18:48:43 Moved these and implementation up to publics.
45 void AddMenuListener(views::MenuListener* listener);
46
47 // Remove a menu listener.
48 void RemoveMenuListener(views::MenuListener* listener);
49
50 // Overridden from ui::AcceleratorProvider:
51 virtual bool GetAcceleratorForCommandId(
52 int command_id, ui::Accelerator* accelerator) OVERRIDE;
sky 2011/05/03 18:38:32 each param on its own line when you wrap.
SteveT 2011/05/06 18:48:43 Done.
53
54 private:
55 // views::ButtonListener implementation.
56 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
57
58 // Load the images for the back and forward buttons.
59 void LoadImages();
60
61 BrowserView* browser_view_;
62
63 bool initialized_;
64
65 // Button and models for the wrench/app menu.
66 views::MenuButton* app_menu_;
67 scoped_ptr<ui::SimpleMenuModel> wrench_menu_model_;
68 scoped_refptr<WrenchMenu> wrench_menu_;
69 std::vector<views::MenuListener*> menu_listeners_;
70
71 // TODO(stevet): Add the BrowserActionsContainer.
72
73 // If non-null the destructor sets this to true. This is set to a non-null
74 // while the menu is showing and used to detect if the menu was deleted while
75 // running.
76 bool* destroyed_flag_;
77
78 DISALLOW_COPY_AND_ASSIGN(CompactOptionsBar);
79 };
80
81 #endif // CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_OPTIONS_BAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698