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

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

Issue 23530070: backup for dynamic recent tabs submenu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new RecentTabsMenuModelDelegate w/ new intf Created 7 years, 2 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/simple_menu_model.h ('k') | ui/views/controls/menu/menu_item_view.h » ('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 #include "ui/base/models/simple_menu_model.h" 5 #include "ui/base/models/simple_menu_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 NORMAL_SEPARATOR }; 231 NORMAL_SEPARATOR };
232 InsertItemAtIndex(item, index); 232 InsertItemAtIndex(item, index);
233 } 233 }
234 234
235 void SimpleMenuModel::InsertSubMenuWithStringIdAt( 235 void SimpleMenuModel::InsertSubMenuWithStringIdAt(
236 int index, int command_id, int string_id, MenuModel* model) { 236 int index, int command_id, int string_id, MenuModel* model) {
237 InsertSubMenuAt(index, command_id, l10n_util::GetStringUTF16(string_id), 237 InsertSubMenuAt(index, command_id, l10n_util::GetStringUTF16(string_id),
238 model); 238 model);
239 } 239 }
240 240
241 void SimpleMenuModel::RemoveItemAt(int index) {
242 items_.erase(items_.begin() + ValidateItemIndex(index));
243 MenuItemsChanged();
244 }
245
241 void SimpleMenuModel::SetIcon(int index, const gfx::Image& icon) { 246 void SimpleMenuModel::SetIcon(int index, const gfx::Image& icon) {
242 items_[ValidateItemIndex(index)].icon = icon; 247 items_[ValidateItemIndex(index)].icon = icon;
243 MenuItemsChanged(); 248 MenuItemsChanged();
244 } 249 }
245 250
246 void SimpleMenuModel::SetSublabel(int index, const base::string16& sublabel) { 251 void SimpleMenuModel::SetSublabel(int index, const base::string16& sublabel) {
247 items_[ValidateItemIndex(index)].sublabel = sublabel; 252 items_[ValidateItemIndex(index)].sublabel = sublabel;
248 MenuItemsChanged(); 253 MenuItemsChanged();
249 } 254 }
250 255
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 #ifndef NDEBUG 452 #ifndef NDEBUG
448 if (item.type == TYPE_SEPARATOR) { 453 if (item.type == TYPE_SEPARATOR) {
449 DCHECK_EQ(item.command_id, kSeparatorId); 454 DCHECK_EQ(item.command_id, kSeparatorId);
450 } else { 455 } else {
451 DCHECK_GE(item.command_id, 0); 456 DCHECK_GE(item.command_id, 0);
452 } 457 }
453 #endif // NDEBUG 458 #endif // NDEBUG
454 } 459 }
455 460
456 } // namespace ui 461 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/models/simple_menu_model.h ('k') | ui/views/controls/menu/menu_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698