| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef APP_MENUS_SIMPLE_MENU_MODEL_H_ | 5 #ifndef APP_MENUS_SIMPLE_MENU_MODEL_H_ |
| 6 #define APP_MENUS_SIMPLE_MENU_MODEL_H_ | 6 #define APP_MENUS_SIMPLE_MENU_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 virtual MenuModel* GetSubmenuModelAt(int index) const; | 80 virtual MenuModel* GetSubmenuModelAt(int index) const; |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 // Some variants of this model (SystemMenuModel) relies on items to be | 83 // Some variants of this model (SystemMenuModel) relies on items to be |
| 84 // inserted backwards. This is counter-intuitive for the API, so rather than | 84 // inserted backwards. This is counter-intuitive for the API, so rather than |
| 85 // forcing customers to insert things backwards, we return the indices | 85 // forcing customers to insert things backwards, we return the indices |
| 86 // backwards instead. That's what this method is for. By default, it just | 86 // backwards instead. That's what this method is for. By default, it just |
| 87 // returns what it's passed. | 87 // returns what it's passed. |
| 88 virtual int FlipIndex(int index) const { return index; } | 88 virtual int FlipIndex(int index) const { return index; } |
| 89 | 89 |
| 90 Delegate* delegate() { return delegate_; } |
| 91 |
| 90 private: | 92 private: |
| 91 struct Item { | 93 struct Item { |
| 92 int command_id; | 94 int command_id; |
| 93 string16 label; | 95 string16 label; |
| 94 ItemType type; | 96 ItemType type; |
| 95 int group_id; | 97 int group_id; |
| 96 MenuModel* submenu; | 98 MenuModel* submenu; |
| 97 }; | 99 }; |
| 98 std::vector<Item> items_; | 100 std::vector<Item> items_; |
| 99 | 101 |
| 100 Delegate* delegate_; | 102 Delegate* delegate_; |
| 101 | 103 |
| 102 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 104 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 } // namespace menus | 107 } // namespace menus |
| 106 | 108 |
| 107 #endif // APP_MENUS_SIMPLE_MENU_MODEL_H_ | 109 #endif // APP_MENUS_SIMPLE_MENU_MODEL_H_ |
| OLD | NEW |