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_; |