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

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: Addressed second review Created 8 years, 4 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
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 GetSeparatorStyleAt(
54 int index) const OVERRIDE {
55 return items_[index - GetFirstItemIndex(NULL)].type == TYPE_SEPARATOR ?
56 ui::NORMAL_SEPARATOR : ui::NORMAL_SEPARATOR;
sky 2012/08/21 19:36:29 Both values return ui::NORMAL_SEPARATOR here.
Mr4D (OOO till 08-26) 2012/08/21 21:34:54 Right. Happened after your last change request. Wh
57 }
58
53 virtual int GetCommandIdAt(int index) const OVERRIDE { 59 virtual int GetCommandIdAt(int index) const OVERRIDE {
54 return index - GetFirstItemIndex(NULL) + command_id_base_; 60 return index - GetFirstItemIndex(NULL) + command_id_base_;
55 } 61 }
56 62
57 string16 GetLabelAt(int index) const OVERRIDE { 63 string16 GetLabelAt(int index) const OVERRIDE {
58 return items_[index - GetFirstItemIndex(NULL)].label; 64 return items_[index - GetFirstItemIndex(NULL)].label;
59 } 65 }
60 66
61 virtual bool IsItemDynamicAt(int index) const OVERRIDE { 67 virtual bool IsItemDynamicAt(int index) const OVERRIDE {
62 return false; 68 return false;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 submodel->set_last_activation(-1); 305 submodel->set_last_activation(-1);
300 } 306 }
301 307
302 // Check that selecting the root item is safe. The MenuModel does 308 // Check that selecting the root item is safe. The MenuModel does
303 // not care about the root so MenuModelAdapter should do nothing 309 // not care about the root so MenuModelAdapter should do nothing
304 // (not hit the NOTREACHED check) when the root is selected. 310 // (not hit the NOTREACHED check) when the root is selected.
305 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu); 311 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu);
306 } 312 }
307 313
308 } // namespace views 314 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698