| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 | 10 |
| 11 // A description for a menu item. It contains the menu item description as well | 11 // A description for a menu item. It contains the menu item description as well |
| 12 // as the function which gets executed upon menu item click. | 12 // as the function which gets executed upon menu item click. |
| 13 class ChromeLauncherAppMenuItem { | 13 class ChromeLauncherAppMenuItem { |
| 14 public: | 14 public: |
| 15 // To insert a separator before this item set |has_leading_separator|. | 15 // To insert a separator before this item set |has_leading_separator|. |
| 16 ChromeLauncherAppMenuItem(const base::string16 title, | 16 ChromeLauncherAppMenuItem(const base::string16 title, |
| 17 const gfx::Image* icon, | 17 const gfx::Image* icon, |
| 18 bool has_leading_separator); | 18 bool has_leading_separator); |
| 19 | 19 |
| 20 virtual ~ChromeLauncherAppMenuItem(); | 20 virtual ~ChromeLauncherAppMenuItem(); |
| 21 | 21 |
| 22 // Retrieves the title for this menu option. | 22 // Retrieves the title for this menu option. |
| 23 const base::string16& title() const { return title_; } | 23 const base::string16& title() const { return title_; } |
| 24 | 24 |
| 25 // Retrieves the icon for this menu option. | 25 // Retrieves the icon for this menu option. |
| 26 const gfx::Image& icon() const { return icon_; } | 26 const gfx::Image& icon() const { return icon_; } |
| 27 | 27 |
| 28 // Returns true if a separator should be inserted before this item. | 28 // Returns true if a separator should be inserted before this item. |
| 29 const bool HasLeadingSeparator() const { return has_leading_separator_; } | 29 bool HasLeadingSeparator() const { return has_leading_separator_; } |
| 30 | 30 |
| 31 // Returns true if the item is active. | 31 // Returns true if the item is active. |
| 32 virtual bool IsActive() const; | 32 virtual bool IsActive() const; |
| 33 | 33 |
| 34 // Returns true if item is enabled. | 34 // Returns true if item is enabled. |
| 35 virtual bool IsEnabled() const; | 35 virtual bool IsEnabled() const; |
| 36 | 36 |
| 37 // Executes the option. | 37 // Executes the option. |
| 38 // |event_flags| are the flags from the event which issued this command. | 38 // |event_flags| are the flags from the event which issued this command. |
| 39 // It can be used to check additional keyboard modifiers. | 39 // It can be used to check additional keyboard modifiers. |
| 40 virtual void Execute(int event_flags); | 40 virtual void Execute(int event_flags); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 const base::string16 title_; | 43 const base::string16 title_; |
| 44 const gfx::Image icon_; | 44 const gfx::Image icon_; |
| 45 | 45 |
| 46 // True if the item has a separator in front of it. | 46 // True if the item has a separator in front of it. |
| 47 const bool has_leading_separator_; | 47 const bool has_leading_separator_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherAppMenuItem); | 49 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherAppMenuItem); |
| 50 }; | 50 }; |
| 51 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_ | 51 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_ |
| OLD | NEW |