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

Side by Side Diff: ui/views/controls/menu/menu_model_adapter_unittest.cc

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another merge! Created 8 years, 3 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/views/controls/menu/menu_item_view.cc ('k') | ui/views/controls/menu/menu_separator.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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "ui/base/l10n/l10n_util.h" 6 #include "ui/base/l10n/l10n_util.h"
7 #include "ui/base/models/menu_model.h" 7 #include "ui/base/models/menu_model.h"
8 #include "ui/base/models/menu_model_delegate.h" 8 #include "ui/base/models/menu_model_delegate.h"
9 #include "ui/views/controls/menu/menu_item_view.h" 9 #include "ui/views/controls/menu/menu_item_view.h"
10 #include "ui/views/controls/menu/menu_model_adapter.h" 10 #include "ui/views/controls/menu/menu_model_adapter.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 virtual int GetItemCount() const OVERRIDE { 45 virtual int GetItemCount() const OVERRIDE {
46 return static_cast<int>(items_.size()); 46 return static_cast<int>(items_.size());
47 } 47 }
48 48
49 virtual ItemType GetTypeAt(int index) const OVERRIDE { 49 virtual ItemType GetTypeAt(int index) const OVERRIDE {
50 return items_[index - GetFirstItemIndex(NULL)].type; 50 return items_[index - GetFirstItemIndex(NULL)].type;
51 } 51 }
52 52
53 virtual ui::MenuSeparatorType GetSeparatorTypeAt(
54 int index) const OVERRIDE {
55 return ui::NORMAL_SEPARATOR;
56 }
57
53 virtual int GetCommandIdAt(int index) const OVERRIDE { 58 virtual int GetCommandIdAt(int index) const OVERRIDE {
54 return index - GetFirstItemIndex(NULL) + command_id_base_; 59 return index - GetFirstItemIndex(NULL) + command_id_base_;
55 } 60 }
56 61
57 string16 GetLabelAt(int index) const OVERRIDE { 62 string16 GetLabelAt(int index) const OVERRIDE {
58 return items_[index - GetFirstItemIndex(NULL)].label; 63 return items_[index - GetFirstItemIndex(NULL)].label;
59 } 64 }
60 65
61 virtual bool IsItemDynamicAt(int index) const OVERRIDE { 66 virtual bool IsItemDynamicAt(int index) const OVERRIDE {
62 return false; 67 return false;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 submodel->set_last_activation(-1); 304 submodel->set_last_activation(-1);
300 } 305 }
301 306
302 // Check that selecting the root item is safe. The MenuModel does 307 // Check that selecting the root item is safe. The MenuModel does
303 // not care about the root so MenuModelAdapter should do nothing 308 // not care about the root so MenuModelAdapter should do nothing
304 // (not hit the NOTREACHED check) when the root is selected. 309 // (not hit the NOTREACHED check) when the root is selected.
305 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu); 310 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu);
306 } 311 }
307 312
308 } // namespace views 313 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | ui/views/controls/menu/menu_separator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698