| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/status/status_area_button.h" | 9 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 10 #include "views/controls/menu/menu_2.h" | 10 #include "views/controls/menu/menu_2.h" |
| 11 #include "views/controls/menu/view_menu_delegate.h" | 11 #include "views/controls/menu/view_menu_delegate.h" |
| 12 | 12 |
| 13 class SkBitmap; | 13 class SkBitmap; |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 class StatusAreaHost; | 17 class StatusAreaHost; |
| 18 | 18 |
| 19 // The language menu button in the status area. | 19 // The language menu button in the status area. |
| 20 // This class will handle getting the IME/XKB status and populating the menu. | 20 // This class will handle getting the IME/XKB status and populating the menu. |
| 21 class FeedbackMenuButton : public StatusAreaButton, | 21 class FeedbackMenuButton : public StatusAreaButton, |
| 22 public views::ViewMenuDelegate, | 22 public views::ViewMenuDelegate, |
| 23 public menus::MenuModel { | 23 public menus::MenuModel { |
| 24 public: | 24 public: |
| 25 explicit FeedbackMenuButton(StatusAreaHost* host); | 25 explicit FeedbackMenuButton(StatusAreaHost* host); |
| 26 virtual ~FeedbackMenuButton(); | 26 virtual ~FeedbackMenuButton(); |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // StatusAreaButton implementation. | |
| 30 virtual void DrawPressed(gfx::Canvas* canvas); | |
| 31 virtual void DrawIcon(gfx::Canvas* canvas); | |
| 32 | |
| 33 // views::ViewMenuDelegate implementation. | 29 // views::ViewMenuDelegate implementation. |
| 34 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 30 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 35 | 31 |
| 36 // menus::MenuModel implementation. | 32 // menus::MenuModel implementation. |
| 37 virtual int GetItemCount() const { return 0; } | 33 virtual int GetItemCount() const { return 0; } |
| 38 virtual bool HasIcons() const { return false; } | 34 virtual bool HasIcons() const { return false; } |
| 39 virtual menus::MenuModel::ItemType GetTypeAt(int index) const { | 35 virtual menus::MenuModel::ItemType GetTypeAt(int index) const { |
| 40 return menus::MenuModel::TYPE_COMMAND; | 36 return menus::MenuModel::TYPE_COMMAND; |
| 41 } | 37 } |
| 42 virtual int GetCommandIdAt(int index) const { return index; } | 38 virtual int GetCommandIdAt(int index) const { return index; } |
| 43 virtual string16 GetLabelAt(int index) const { return string16(); } | 39 virtual string16 GetLabelAt(int index) const { return string16(); } |
| 44 virtual bool IsLabelDynamicAt(int index) const { return true; } | 40 virtual bool IsLabelDynamicAt(int index) const { return true; } |
| 45 virtual bool GetAcceleratorAt(int index, | 41 virtual bool GetAcceleratorAt(int index, |
| 46 menus::Accelerator* accelerator) const { return false; } | 42 menus::Accelerator* accelerator) const { return false; } |
| 47 virtual bool IsItemCheckedAt(int index) const { return false; } | 43 virtual bool IsItemCheckedAt(int index) const { return false; } |
| 48 virtual int GetGroupIdAt(int index) const { return 0; } | 44 virtual int GetGroupIdAt(int index) const { return 0; } |
| 49 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } | 45 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } |
| 50 virtual menus::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const { | 46 virtual menus::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const { |
| 51 return NULL; | 47 return NULL; |
| 52 } | 48 } |
| 53 virtual bool IsEnabledAt(int index) const { return false; } | 49 virtual bool IsEnabledAt(int index) const { return false; } |
| 54 virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } | 50 virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } |
| 55 virtual void HighlightChangedTo(int index) {} | 51 virtual void HighlightChangedTo(int index) {} |
| 56 virtual void ActivatedAt(int index) {} | 52 virtual void ActivatedAt(int index) {} |
| 57 virtual void MenuWillShow() {} | 53 virtual void MenuWillShow() {} |
| 58 | 54 |
| 59 // This method will draw the |icon| in the appropriate place on the |canvas|. | |
| 60 void DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon); | |
| 61 | |
| 62 StatusAreaHost* host_; | 55 StatusAreaHost* host_; |
| 63 | 56 |
| 64 DISALLOW_COPY_AND_ASSIGN(FeedbackMenuButton); | 57 DISALLOW_COPY_AND_ASSIGN(FeedbackMenuButton); |
| 65 }; | 58 }; |
| 66 | 59 |
| 67 } // namespace chromeos | 60 } // namespace chromeos |
| 68 | 61 |
| 69 #endif // CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ |
| OLD | NEW |