Chromium Code Reviews| Index: chrome/browser/chromeos/status/power_menu_button.h |
| diff --git a/chrome/browser/chromeos/status/power_menu_button.h b/chrome/browser/chromeos/status/power_menu_button.h |
| index 709d2bc40a4d10aebe0cf664c3d9323ac84165c6..e6a6b165fb952ac4a3f95a4439691d02030efa74 100644 |
| --- a/chrome/browser/chromeos/status/power_menu_button.h |
| +++ b/chrome/browser/chromeos/status/power_menu_button.h |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| +// 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. |
| @@ -8,8 +8,7 @@ |
| #include "chrome/browser/chromeos/cros/power_library.h" |
| #include "chrome/browser/chromeos/status/status_area_button.h" |
| -#include "ui/base/models/menu_model.h" |
| -#include "views/controls/menu/menu_2.h" |
| +#include "views/controls/menu/menu_delegate.h" |
| #include "views/controls/menu/view_menu_delegate.h" |
| namespace base { |
| @@ -23,34 +22,16 @@ namespace chromeos { |
| // The power menu button in the status area. |
| // This class will handle getting the power status and populating the menu. |
| class PowerMenuButton : public StatusAreaButton, |
| + public views::MenuDelegate, |
| public views::ViewMenuDelegate, |
| - public ui::MenuModel, |
| public PowerLibrary::Observer { |
| public: |
| PowerMenuButton(); |
| virtual ~PowerMenuButton(); |
| - // 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 { return false; } |
| - 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; |
|
oshima
2011/04/14 17:27:31
OVERRIDE
rhashimoto
2011/04/14 18:27:04
Done.
|
| + virtual bool IsCommandEnabled(int id) const; |
| // PowerLibrary::Observer implementation. |
| virtual void PowerChanged(PowerLibrary* obj); |
| @@ -65,6 +46,10 @@ class PowerMenuButton : public StatusAreaButton, |
| // views::ViewMenuDelegate implementation. |
| virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| + // Format strings with power status |
| + string16 GetBatteryPercentageText() const; |
| + string16 GetBatteryIsChargedText() const; |
| + |
| // Update the power icon and menu label info depending on the power status. |
| void UpdateIconAndLabelInfo(); |
| @@ -82,9 +67,8 @@ class PowerMenuButton : public StatusAreaButton, |
| // The currently showing icon bitmap id. |
| int icon_id_; |
| - // The power menu. This needs to be initialized last since it calls into |
| - // GetLabelAt() during construction. |
| - views::Menu2 power_menu_; |
| + // The power menu. |
| + scoped_ptr<views::MenuItemView> menu_; |
| DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
| }; |