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

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

Issue 2928005: Retrieve favicons from history as NavigationEntries are converted from TabNav... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Updated to compile against trunk. Created 9 years, 9 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) 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 #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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 virtual bool HasIcons() const; 105 virtual bool HasIcons() const;
106 virtual int GetItemCount() const; 106 virtual int GetItemCount() const;
107 virtual ItemType GetTypeAt(int index) const; 107 virtual ItemType GetTypeAt(int index) const;
108 virtual int GetCommandIdAt(int index) const; 108 virtual int GetCommandIdAt(int index) const;
109 virtual string16 GetLabelAt(int index) const; 109 virtual string16 GetLabelAt(int index) const;
110 virtual bool IsItemDynamicAt(int index) const; 110 virtual bool IsItemDynamicAt(int index) const;
111 virtual bool GetAcceleratorAt(int index, 111 virtual bool GetAcceleratorAt(int index,
112 ui::Accelerator* accelerator) const; 112 ui::Accelerator* accelerator) const;
113 virtual bool IsItemCheckedAt(int index) const; 113 virtual bool IsItemCheckedAt(int index) const;
114 virtual int GetGroupIdAt(int index) const; 114 virtual int GetGroupIdAt(int index) const;
115 virtual bool GetIconAt(int index, SkBitmap* icon) const; 115 virtual bool GetIconAt(int index, SkBitmap* icon);
116 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const; 116 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const;
117 virtual bool IsEnabledAt(int index) const; 117 virtual bool IsEnabledAt(int index) const;
118 virtual bool IsVisibleAt(int index) const; 118 virtual bool IsVisibleAt(int index) const;
119 virtual void HighlightChangedTo(int index); 119 virtual void HighlightChangedTo(int index);
120 virtual void ActivatedAt(int index); 120 virtual void ActivatedAt(int index);
121 virtual MenuModel* GetSubmenuModelAt(int index) const; 121 virtual MenuModel* GetSubmenuModelAt(int index) const;
122 virtual void MenuClosed(); 122 virtual void MenuClosed();
123 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* menu_model_delegate);
123 124
124 protected: 125 protected:
125 // Some variants of this model (SystemMenuModel) relies on items to be 126 // Some variants of this model (SystemMenuModel) relies on items to be
126 // inserted backwards. This is counter-intuitive for the API, so rather than 127 // inserted backwards. This is counter-intuitive for the API, so rather than
127 // forcing customers to insert things backwards, we return the indices 128 // forcing customers to insert things backwards, we return the indices
128 // backwards instead. That's what this method is for. By default, it just 129 // backwards instead. That's what this method is for. By default, it just
129 // returns what it's passed. 130 // returns what it's passed.
130 virtual int FlipIndex(int index) const; 131 virtual int FlipIndex(int index) const;
131 132
132 Delegate* delegate() { return delegate_; } 133 Delegate* delegate() { return delegate_; }
133 134
135 MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; }
136
134 private: 137 private:
135 struct Item; 138 struct Item;
136 139
137 // Functions for inserting items into |items_|. 140 // Functions for inserting items into |items_|.
138 void AppendItem(const Item& item); 141 void AppendItem(const Item& item);
139 void InsertItemAtIndex(const Item& item, int index); 142 void InsertItemAtIndex(const Item& item, int index);
140 void ValidateItem(const Item& item); 143 void ValidateItem(const Item& item);
141 144
142 // Notify the delegate that the menu is closed. 145 // Notify the delegate that the menu is closed.
143 void OnMenuClosed(); 146 void OnMenuClosed();
144 147
145 std::vector<Item> items_; 148 std::vector<Item> items_;
146 149
147 Delegate* delegate_; 150 Delegate* delegate_;
148 151
152 MenuModelDelegate* menu_model_delegate_;
153
149 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; 154 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_;
150 155
151 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); 156 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel);
152 }; 157 };
153 158
154 } // namespace ui 159 } // namespace ui
155 160
156 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ 161 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698