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

Unified Diff: chrome/browser/chromeos/status/network_menu.h

Issue 6811025: Change status button menu implementation from Menu2 to MenuItemView. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed crash in VPN submenu. 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/chromeos/status/network_menu.h
diff --git a/chrome/browser/chromeos/status/network_menu.h b/chrome/browser/chromeos/status/network_menu.h
index 62c1a8ed5a0d95c3b026adbef30ce817bb23492f..2514ec9664fcbcf739c00ed643b5341e50475df5 100644
--- a/chrome/browser/chromeos/status/network_menu.h
+++ b/chrome/browser/chromeos/status/network_menu.h
@@ -13,6 +13,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/menu_model.h"
#include "ui/gfx/native_widget_types.h"
+#include "views/controls/menu/menu_delegate.h"
#include "views/controls/menu/view_menu_delegate.h"
namespace gfx {
@@ -20,14 +21,14 @@ class Canvas;
}
namespace views {
-class Menu2;
+class MenuItemView;
}
namespace chromeos {
class NetworkMenu;
-class NetworkMenuModel : public ui::MenuModel {
+class NetworkMenuModel : public views::MenuDelegate {
stevenjb 2011/04/21 22:25:31 This should have come up in the CL where this was
rhashimoto 2011/04/21 22:49:58 Done.
public:
struct NetworkInfo {
NetworkInfo() :
@@ -53,6 +54,13 @@ class NetworkMenuModel : public ui::MenuModel {
explicit NetworkMenuModel(NetworkMenu* owner) : owner_(owner) {}
virtual ~NetworkMenuModel() {}
+ // views::MenuDelegate implementation ----------------------------------------
+
+ virtual const gfx::Font& GetLabelFont(int id) const OVERRIDE;
+ virtual bool IsItemChecked(int id) const OVERRIDE;
+ virtual bool IsCommandEnabled(int id) const OVERRIDE;
+ virtual void ExecuteCommand(int id) OVERRIDE;
+
// Connect or reconnect to the network at |index|.
// If remember >= 0, set the favorite state of the network.
// Returns true if a connect occurred (e.g. menu should be closed).
@@ -65,28 +73,16 @@ class NetworkMenuModel : public ui::MenuModel {
virtual void InitMenuItems(bool is_browser_mode,
bool should_open_button_options) {}
- // ui::MenuModel implementation.
- virtual bool HasIcons() const { return true; }
- virtual int GetItemCount() const;
- virtual ui::MenuModel::ItemType GetTypeAt(int index) const;
- virtual int GetCommandIdAt(int index) const { return index; }
- virtual string16 GetLabelAt(int index) const;
- virtual bool IsItemDynamicAt(int index) const { return true; }
- virtual const gfx::Font* GetLabelFontAt(int index) const;
- virtual bool GetAcceleratorAt(int index,
- ui::Accelerator* accelerator) const { return false; }
- virtual bool IsItemCheckedAt(int index) const;
- virtual int GetGroupIdAt(int index) const { return 0; }
- virtual bool GetIconAt(int index, SkBitmap* icon);
- virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const {
- return NULL;
- }
- virtual bool IsEnabledAt(int index) const;
- virtual ui::MenuModel* GetSubmenuModelAt(int index) const;
- virtual void HighlightChangedTo(int index) {}
- virtual void ActivatedAt(int index);
- virtual void MenuWillShow() {}
- virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) {}
+ // PopulateMenu() clears and reinstalls the menu items defined in this
+ // instance by calling PopulateMenuItem() on each one. Subclasses with
+ // submenus should override PopulateMenuItem(), deferring to the base
+ // class implementation for non-submenu items and calling PopulateMenu()
+ // for the submenu after adding it.
+ virtual void PopulateMenu(views::MenuItemView* menu);
+ virtual void PopulateMenuItem(
+ views::MenuItemView* menu,
+ int index,
+ int command_id);
protected:
enum MenuItemFlags {
@@ -253,6 +249,7 @@ class NetworkMenu : public views::ViewMenuDelegate {
const SkBitmap* bottom_left_badge);
protected:
+ virtual views::MenuButton* GetMenuButton() = 0;
virtual gfx::NativeWindow GetNativeWindow() const = 0;
virtual void OpenButtonOptions() = 0;
virtual bool ShouldOpenButtonOptions() const = 0;
@@ -289,7 +286,7 @@ class NetworkMenu : public views::ViewMenuDelegate {
static SkBitmap kAnimatingImagesBlack[];
// The network menu.
- scoped_ptr<views::Menu2> network_menu_;
+ scoped_ptr<views::MenuItemView> network_menu_;
scoped_ptr<NetworkMenuModel> main_menu_model_;

Powered by Google App Engine
This is Rietveld 408576698