Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: ui/base/models/simple_menu_model.h

Issue 11791039: Removes SimpleMenuModel::FlipIndex. It was only used by (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/models/menu_model.h ('k') | ui/base/models/simple_menu_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 5 #ifndef UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 virtual void ActivatedAt(int index) OVERRIDE; 135 virtual void ActivatedAt(int index) OVERRIDE;
136 virtual void ActivatedAt(int index, int event_flags) OVERRIDE; 136 virtual void ActivatedAt(int index, int event_flags) OVERRIDE;
137 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; 137 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE;
138 virtual void MenuWillShow() OVERRIDE; 138 virtual void MenuWillShow() OVERRIDE;
139 virtual void MenuClosed() OVERRIDE; 139 virtual void MenuClosed() OVERRIDE;
140 virtual void SetMenuModelDelegate( 140 virtual void SetMenuModelDelegate(
141 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; 141 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE;
142 virtual MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE; 142 virtual MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE;
143 143
144 protected: 144 protected:
145 // Some variants of this model (SystemMenuModel) relies on items to be
146 // inserted backwards. This is counter-intuitive for the API, so rather than
147 // forcing customers to insert things backwards, we return the indices
148 // backwards instead. That's what this method is for. By default, it just
149 // returns what it's passed.
150 virtual int FlipIndex(int index) const;
151
152 void set_delegate(Delegate* delegate) { delegate_ = delegate; } 145 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
153 Delegate* delegate() { return delegate_; } 146 Delegate* delegate() { return delegate_; }
154 147
155 private: 148 private:
156 struct Item; 149 struct Item;
157 150
158 typedef std::vector<Item> ItemVector; 151 typedef std::vector<Item> ItemVector;
159 152
160 // Caller needs to call FlipIndex() if necessary. Returns |index|. 153 // Returns |index|.
161 int ValidateItemIndex(int index) const; 154 int ValidateItemIndex(int index) const;
162 155
163 // Functions for inserting items into |items_|. 156 // Functions for inserting items into |items_|.
164 void AppendItem(const Item& item); 157 void AppendItem(const Item& item);
165 void InsertItemAtIndex(const Item& item, int index); 158 void InsertItemAtIndex(const Item& item, int index);
166 void ValidateItem(const Item& item); 159 void ValidateItem(const Item& item);
167 160
168 // Notify the delegate that the menu is closed. 161 // Notify the delegate that the menu is closed.
169 void OnMenuClosed(); 162 void OnMenuClosed();
170 163
171 ItemVector items_; 164 ItemVector items_;
172 165
173 Delegate* delegate_; 166 Delegate* delegate_;
174 167
175 MenuModelDelegate* menu_model_delegate_; 168 MenuModelDelegate* menu_model_delegate_;
176 169
177 base::WeakPtrFactory<SimpleMenuModel> method_factory_; 170 base::WeakPtrFactory<SimpleMenuModel> method_factory_;
178 171
179 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); 172 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel);
180 }; 173 };
181 174
182 } // namespace ui 175 } // namespace ui
183 176
184 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 177 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « ui/base/models/menu_model.h ('k') | ui/base/models/simple_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698