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

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

Issue 6893046: added CTRL+Click and SHIFT+Click handler for context menu, Back and Forward. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: make this patch applicable to the latest trunk Created 9 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 | « views/controls/menu/menu_model_adapter.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/l10n/l10n_util.h" 5 #include "ui/base/l10n/l10n_util.h"
6 #include "ui/base/models/menu_model.h" 6 #include "ui/base/models/menu_model.h"
7 #include "ui/base/models/menu_model_delegate.h" 7 #include "ui/base/models/menu_model_delegate.h"
8 #include "views/controls/menu/menu_item_view.h" 8 #include "views/controls/menu/menu_item_view.h"
9 #include "views/controls/menu/menu_model_adapter.h" 9 #include "views/controls/menu/menu_model_adapter.h"
10 #include "views/controls/menu/submenu_view.h" 10 #include "views/controls/menu/submenu_view.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return items_[index - GetFirstItemIndex(NULL)].submenu; 97 return items_[index - GetFirstItemIndex(NULL)].submenu;
98 } 98 }
99 99
100 virtual void HighlightChangedTo(int index) OVERRIDE { 100 virtual void HighlightChangedTo(int index) OVERRIDE {
101 } 101 }
102 102
103 virtual void ActivatedAt(int index) OVERRIDE { 103 virtual void ActivatedAt(int index) OVERRIDE {
104 set_last_activation(index); 104 set_last_activation(index);
105 } 105 }
106 106
107 virtual void ActivatedAtWithDisposition(int index, int disposition) OVERRIDE { 107 virtual void ActivatedAtWithFlags(int index, int flags) OVERRIDE {
108 ActivatedAt(index); 108 ActivatedAt(index);
109 } 109 }
110 110
111 virtual void MenuWillShow() OVERRIDE { 111 virtual void MenuWillShow() OVERRIDE {
112 } 112 }
113 113
114 virtual void MenuClosed() OVERRIDE { 114 virtual void MenuClosed() OVERRIDE {
115 } 115 }
116 116
117 virtual void SetMenuModelDelegate( 117 virtual void SetMenuModelDelegate(
(...skipping 12 matching lines...) Expand all
130 130
131 ItemType type; 131 ItemType type;
132 string16 label; 132 string16 label;
133 ui::MenuModel* submenu; 133 ui::MenuModel* submenu;
134 }; 134 };
135 135
136 const Item& GetItemDefinition(int index) { 136 const Item& GetItemDefinition(int index) {
137 return items_[index]; 137 return items_[index];
138 } 138 }
139 139
140 // Access index argument to ActivatedAt() or ActivatedAtWithDisposition(). 140 // Access index argument to ActivatedAt() or ActivatedAtWithFlags().
141 int last_activation() const { return last_activation_; } 141 int last_activation() const { return last_activation_; }
142 void set_last_activation(int last_activation) { 142 void set_last_activation(int last_activation) {
143 last_activation_ = last_activation; 143 last_activation_ = last_activation;
144 } 144 }
145 145
146 protected: 146 protected:
147 std::vector<Item> items_; 147 std::vector<Item> items_;
148 148
149 private: 149 private:
150 int command_id_base_; 150 int command_id_base_;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 submodel->set_last_activation(-1); 294 submodel->set_last_activation(-1);
295 } 295 }
296 296
297 // Check that selecting the root item is safe. The MenuModel does 297 // Check that selecting the root item is safe. The MenuModel does
298 // not care about the root so MenuModelAdapter should do nothing 298 // not care about the root so MenuModelAdapter should do nothing
299 // (not hit the NOTREACHED check) when the root is selected. 299 // (not hit the NOTREACHED check) when the root is selected.
300 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu.get()); 300 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu.get());
301 } 301 }
302 302
303 } // namespace views 303 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_model_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698