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

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

Issue 10458045: Cleanup: Remove vector::at() calls in SimpleMenuModel. Do CHECKs instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | « no previous file | 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 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void set_delegate(Delegate* delegate) { delegate_ = delegate; } 148 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
149 Delegate* delegate() { return delegate_; } 149 Delegate* delegate() { return delegate_; }
150 150
151 MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } 151 MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; }
152 152
153 private: 153 private:
154 struct Item; 154 struct Item;
155 155
156 typedef std::vector<Item> ItemVector; 156 typedef std::vector<Item> ItemVector;
157 157
158 // Caller needs to call FlipIndex() if necessary. Returns |index|.
159 int ValidateItemIndex(int index) const;
160
158 // Functions for inserting items into |items_|. 161 // Functions for inserting items into |items_|.
159 void AppendItem(const Item& item); 162 void AppendItem(const Item& item);
160 void InsertItemAtIndex(const Item& item, int index); 163 void InsertItemAtIndex(const Item& item, int index);
161 void ValidateItem(const Item& item); 164 void ValidateItem(const Item& item);
162 165
163 // Notify the delegate that the menu is closed. 166 // Notify the delegate that the menu is closed.
164 void OnMenuClosed(); 167 void OnMenuClosed();
165 168
166 ItemVector items_; 169 ItemVector items_;
167 170
168 Delegate* delegate_; 171 Delegate* delegate_;
169 172
170 MenuModelDelegate* menu_model_delegate_; 173 MenuModelDelegate* menu_model_delegate_;
171 174
172 base::WeakPtrFactory<SimpleMenuModel> method_factory_; 175 base::WeakPtrFactory<SimpleMenuModel> method_factory_;
173 176
174 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); 177 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel);
175 }; 178 };
176 179
177 } // namespace ui 180 } // namespace ui
178 181
179 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 182 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/models/simple_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698