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

Side by Side Diff: views/controls/menu/menu_item_view.h

Issue 388007: Fixes possible crash in showing bookmark menu. The problem occurred... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 5 #ifndef VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
6 #define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 6 #define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
7 7
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "views/view.h" 9 #include "views/view.h"
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Returns the mnemonic for this MenuItemView, or 0 if this MenuItemView 211 // Returns the mnemonic for this MenuItemView, or 0 if this MenuItemView
212 // doesn't have a mnemonic. 212 // doesn't have a mnemonic.
213 wchar_t GetMnemonic(); 213 wchar_t GetMnemonic();
214 214
215 // Do we have icons? This only has effect on the top menu. Turning this on 215 // Do we have icons? This only has effect on the top menu. Turning this on
216 // makes the menus slightly wider and taller. 216 // makes the menus slightly wider and taller.
217 void set_has_icons(bool has_icons) { 217 void set_has_icons(bool has_icons) {
218 has_icons_ = has_icons; 218 has_icons_ = has_icons;
219 } 219 }
220 220
221 // Returns the descendant with the specified command.
222 MenuItemView* GetMenuItemByID(int id);
223
221 protected: 224 protected:
222 // Creates a MenuItemView. This is used by the various AddXXX methods. 225 // Creates a MenuItemView. This is used by the various AddXXX methods.
223 MenuItemView(MenuItemView* parent, int command, Type type); 226 MenuItemView(MenuItemView* parent, int command, Type type);
224 227
225 private: 228 private:
226 // Calculates all sizes that we can from the OS. 229 // Calculates all sizes that we can from the OS.
227 // 230 //
228 // This is invoked prior to Running a menu. 231 // This is invoked prior to Running a menu.
229 static void UpdateMenuPartSizes(bool has_icons); 232 static void UpdateMenuPartSizes(bool has_icons);
230 233
231 // Called by the two constructors to initialize this menu item. 234 // Called by the two constructors to initialize this menu item.
232 void Init(MenuItemView* parent, 235 void Init(MenuItemView* parent,
233 int command, 236 int command,
234 MenuItemView::Type type, 237 MenuItemView::Type type,
235 MenuDelegate* delegate); 238 MenuDelegate* delegate);
236 239
237 // All the AddXXX methods funnel into this. 240 // All the AddXXX methods funnel into this.
238 MenuItemView* AppendMenuItemInternal(int item_id, 241 MenuItemView* AppendMenuItemInternal(int item_id,
239 const std::wstring& label, 242 const std::wstring& label,
240 const SkBitmap& icon, 243 const SkBitmap& icon,
241 Type type); 244 Type type);
242 245
243 // Returns the descendant with the specified command.
244 MenuItemView* GetDescendantByID(int id);
245
246 // Invoked by the MenuController when the menu closes as the result of 246 // Invoked by the MenuController when the menu closes as the result of
247 // drag and drop run. 247 // drag and drop run.
248 void DropMenuClosed(bool notify_delegate); 248 void DropMenuClosed(bool notify_delegate);
249 249
250 // The RunXXX methods call into this to set up the necessary state before 250 // The RunXXX methods call into this to set up the necessary state before
251 // running. 251 // running.
252 void PrepareForRun(bool has_mnemonics); 252 void PrepareForRun(bool has_mnemonics);
253 253
254 // Returns the flags passed to DrawStringInt. 254 // Returns the flags passed to DrawStringInt.
255 int GetDrawStringFlags(); 255 int GetDrawStringFlags();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 // Preferred height of menu items. Reset every time a menu is run. 326 // Preferred height of menu items. Reset every time a menu is run.
327 static int pref_menu_height_; 327 static int pref_menu_height_;
328 328
329 DISALLOW_COPY_AND_ASSIGN(MenuItemView); 329 DISALLOW_COPY_AND_ASSIGN(MenuItemView);
330 }; 330 };
331 331
332 } // namespace views 332 } // namespace views
333 333
334 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 334 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_menu_controller_views.cc ('k') | views/controls/menu/menu_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698