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

Unified Diff: chrome/browser/chromeos/status/clock_menu_button.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: Fixes for merge with trunk. 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/clock_menu_button.h
diff --git a/chrome/browser/chromeos/status/clock_menu_button.h b/chrome/browser/chromeos/status/clock_menu_button.h
index 778dcf83bc73a4f43bfef105c156864ec82ffaf4..69fd52bea1a1186c1a3f9144c643e7830866d781 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.h
+++ b/chrome/browser/chromeos/status/clock_menu_button.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
#pragma once
+#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer.h"
#include "chrome/browser/chromeos/cros/power_library.h"
@@ -17,7 +18,7 @@
#include "content/common/notification_type.h"
#include "unicode/calendar.h"
#include "views/controls/button/menu_button.h"
-#include "views/controls/menu/menu_2.h"
+#include "views/controls/menu/menu_delegate.h"
#include "views/controls/menu/view_menu_delegate.h"
namespace chromeos {
@@ -27,8 +28,8 @@ class StatusAreaHost;
// The clock menu button in the status area.
// This button shows the current time.
class ClockMenuButton : public StatusAreaButton,
+ public views::MenuDelegate,
public views::ViewMenuDelegate,
- public ui::MenuModel,
public NotificationObserver,
public PowerLibrary::Observer,
public SystemLibrary::Observer {
@@ -36,27 +37,10 @@ class ClockMenuButton : public StatusAreaButton,
explicit ClockMenuButton(StatusAreaHost* host);
virtual ~ClockMenuButton();
- // ui::MenuModel implementation.
- virtual bool HasIcons() const { return false; }
- 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 bool GetAcceleratorAt(int index,
- ui::Accelerator* accelerator) const { return false; }
- virtual bool IsItemCheckedAt(int index) const { return false; }
- virtual int GetGroupIdAt(int index) const { return 0; }
- virtual bool GetIconAt(int index, SkBitmap* icon) { return false; }
- virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const {
- return NULL;
- }
- virtual bool IsEnabledAt(int index) const;
- virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; }
- virtual void HighlightChangedTo(int index) {}
- virtual void ActivatedAt(int index);
- virtual void MenuWillShow() {}
- virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) {}
+ // views::MenuDelegate implementation
+ virtual std::wstring GetLabel(int id) const OVERRIDE;
+ virtual bool IsCommandEnabled(int id) const OVERRIDE;
+ virtual void ExecuteCommand(int id) OVERRIDE;
// Overridden from ResumeLibrary::Observer:
virtual void PowerChanged(PowerLibrary* obj) {}
@@ -84,6 +68,9 @@ class ClockMenuButton : public StatusAreaButton,
// views::ViewMenuDelegate implementation.
virtual void RunMenu(views::View* source, const gfx::Point& pt);
+ // Create and initialize menu if not already present.
+ void EnsureMenu();
+
// Updates text and schedules the timer to fire at the next minute interval.
void UpdateTextAndSetNextTimer();
@@ -92,7 +79,7 @@ class ClockMenuButton : public StatusAreaButton,
// The clock menu.
// NOTE: we use a scoped_ptr here as menu calls into 'this' from the
// constructor.
- scoped_ptr<views::Menu2> clock_menu_;
+ scoped_ptr<views::MenuItemView> menu_;
StatusAreaHost* host_;

Powered by Google App Engine
This is Rietveld 408576698