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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/compact_nav/compact_options_bar.h
diff --git a/chrome/browser/ui/views/compact_nav/compact_options_bar.h b/chrome/browser/ui/views/compact_nav/compact_options_bar.h
new file mode 100755
index 0000000000000000000000000000000000000000..20a7796079756ce20cb0e2d06f3b9fac2f3629b4
--- /dev/null
+++ b/chrome/browser/ui/views/compact_nav/compact_options_bar.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_OPTIONS_BAR_H_
+#define CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_OPTIONS_BAR_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/command_updater.h"
+#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.
+#include "ui/base/models/simple_menu_model.h"
+#include "views/controls/button/button.h"
+#include "views/controls/button/menu_button.h"
sky 2011/05/03 18:38:32 forward declare
SteveT 2011/05/06 18:48:43 Done.
+#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
+#include "views/controls/menu/view_menu_delegate.h"
+#include "views/view.h"
+
+class BrowserView;
+
+// This class provides a small options bar that includes browser actions and
+// the wrench menu button.
+class CompactOptionsBar : public views::View,
+ public views::ViewMenuDelegate,
+ public ui::AcceleratorProvider,
+ public views::ButtonListener {
+ public:
+ explicit CompactOptionsBar(BrowserView* browser_view);
+ virtual ~CompactOptionsBar();
+
+ // Must be called before anything else, but after adding this view to the
+ // widget.
+ void Init();
+
+ // views::View overrides.
+ virtual gfx::Size GetPreferredSize();
sky 2011/05/03 18:38:32 OVERRIDE (and other places)
SteveT 2011/05/06 18:48:43 Done.
+ virtual void Layout();
+ virtual void OnPaint(gfx::Canvas* canvas);
+
+ // Overridden from views::MenuDelegate:
+ virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE;
+
+ // 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.
+ void AddMenuListener(views::MenuListener* listener);
+
+ // Remove a menu listener.
+ void RemoveMenuListener(views::MenuListener* listener);
+
+ // Overridden from ui::AcceleratorProvider:
+ virtual bool GetAcceleratorForCommandId(
+ 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.
+
+ private:
+ // views::ButtonListener implementation.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // Load the images for the back and forward buttons.
+ void LoadImages();
+
+ BrowserView* browser_view_;
+
+ bool initialized_;
+
+ // Button and models for the wrench/app menu.
+ views::MenuButton* app_menu_;
+ scoped_ptr<ui::SimpleMenuModel> wrench_menu_model_;
+ scoped_refptr<WrenchMenu> wrench_menu_;
+ std::vector<views::MenuListener*> menu_listeners_;
+
+ // TODO(stevet): Add the BrowserActionsContainer.
+
+ // If non-null the destructor sets this to true. This is set to a non-null
+ // while the menu is showing and used to detect if the menu was deleted while
+ // running.
+ bool* destroyed_flag_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompactOptionsBar);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_OPTIONS_BAR_H_

Powered by Google App Engine
This is Rietveld 408576698