Home | History | Annotate | Download | only in notifications
      1 // Copyright (c) 2011 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_NOTIFICATIONS_NOTIFICATION_OPTIONS_MENU_MODEL_H_
      6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OPTIONS_MENU_MODEL_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "base/memory/scoped_ptr.h"
     11 #include "ui/base/models/simple_menu_model.h"
     12 
     13 class Balloon;
     14 
     15 // Model for the corner-selection submenu.
     16 class CornerSelectionMenuModel : public ui::SimpleMenuModel,
     17                                  public ui::SimpleMenuModel::Delegate {
     18  public:
     19   explicit CornerSelectionMenuModel(Balloon* balloon);
     20   virtual ~CornerSelectionMenuModel();
     21 
     22   // Overridden from ui::SimpleMenuModel::Delegate:
     23   virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
     24   virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
     25   virtual bool GetAcceleratorForCommandId(
     26       int command_id,
     27       ui::Accelerator* accelerator) OVERRIDE;
     28   virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
     29 
     30  private:
     31   // Not owned.
     32   Balloon* balloon_;
     33 
     34   DISALLOW_COPY_AND_ASSIGN(CornerSelectionMenuModel);
     35 };
     36 
     37 // Model for the notification options menu itself.
     38 class NotificationOptionsMenuModel : public ui::SimpleMenuModel,
     39                                      public ui::SimpleMenuModel::Delegate {
     40  public:
     41   explicit NotificationOptionsMenuModel(Balloon* balloon);
     42   virtual ~NotificationOptionsMenuModel();
     43 
     44   // Overridden from ui::SimpleMenuModel:
     45   virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
     46   virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
     47 
     48   // Overridden from ui::SimpleMenuModel::Delegate:
     49   virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
     50   virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
     51   virtual bool GetAcceleratorForCommandId(
     52       int command_id,
     53       ui::Accelerator* accelerator) OVERRIDE;
     54   virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
     55 
     56  private:
     57   Balloon* balloon_; // Not owned.
     58 
     59   scoped_ptr<CornerSelectionMenuModel> corner_menu_model_;
     60 
     61   DISALLOW_COPY_AND_ASSIGN(NotificationOptionsMenuModel);
     62 };
     63 
     64 #endif  // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OPTIONS_MENU_MODEL_H_
     65