Home | History | Annotate | Download | only in launcher
      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
      3 // found in the LICENSE file.
      4 
      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_
      7 
      8 #include "base/strings/string16.h"
      9 #include "ui/gfx/image/image.h"
     10 
     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.
     13 class ChromeLauncherAppMenuItem {
     14  public:
     15   // To insert a separator before this item set |has_leading_separator|.
     16   ChromeLauncherAppMenuItem(const base::string16 title,
     17                             const gfx::Image* icon,
     18                             bool has_leading_separator);
     19 
     20   virtual ~ChromeLauncherAppMenuItem();
     21 
     22   // Retrieves the title for this menu option.
     23   const base::string16& title() const { return title_; }
     24 
     25   // Retrieves the icon for this menu option.
     26   const gfx::Image& icon() const { return icon_; }
     27 
     28   // Returns true if a separator should be inserted before this item.
     29   bool HasLeadingSeparator() const { return has_leading_separator_; }
     30 
     31   // Returns true if the item is active.
     32   virtual bool IsActive() const;
     33 
     34   // Returns true if item is enabled.
     35   virtual bool IsEnabled() const;
     36 
     37   // Executes the option.
     38   // |event_flags| are the flags from the event which issued this command.
     39   // It can be used to check additional keyboard modifiers.
     40   virtual void Execute(int event_flags);
     41 
     42  private:
     43   const base::string16 title_;
     44   const gfx::Image icon_;
     45 
     46   // True if the item has a separator in front of it.
     47   const bool has_leading_separator_;
     48 
     49   DISALLOW_COPY_AND_ASSIGN(ChromeLauncherAppMenuItem);
     50 };
     51 #endif  // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_APP_MENU_ITEM_H_
     52