| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_RECENT_TABS_MENU_MODEL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_RECENT_TABS_MENU_MODEL_DELEGATE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "ui/base/models/menu_model_delegate.h" |
| 12 |
| 13 class MenuItemsChangedDelegate; |
| 14 class RecentTabsSubMenuModel; |
| 15 |
| 16 namespace gfx { |
| 17 class Font; |
| 18 }; |
| 19 |
| 20 namespace views { |
| 21 class MenuItemView; |
| 22 }; |
| 23 |
| 24 // Provides the ui::MenuModelDelegate implementation for RecentTabsSubMenuModel |
| 25 // items. |
| 26 class RecentTabsMenuModelDelegate : public ui::MenuModelDelegate { |
| 27 public: |
| 28 RecentTabsMenuModelDelegate(MenuItemsChangedDelegate* items_changed_delegate, |
| 29 RecentTabsSubMenuModel* model, |
| 30 views::MenuItemView* menu_item, |
| 31 int first_command_id, |
| 32 int max_command_id); |
| 33 virtual ~RecentTabsMenuModelDelegate(); |
| 34 |
| 35 void PopulateMenu(); |
| 36 |
| 37 // Return the specific menu width of recent tabs submenu if |menu| is the |
| 38 // recent tabs submenu, else return -1. |
| 39 int GetMaxWidthForMenu(views::MenuItemView* menu); |
| 40 |
| 41 const gfx::Font* GetLabelFontAt(int item_id) const; |
| 42 |
| 43 bool GetForegroundColor(int command_id, bool is_hovered, |
| 44 SkColor* override_color) const; |
| 45 |
| 46 // ui::MenuModelDelegate implementation: |
| 47 virtual void OnIconChanged(int index) OVERRIDE; |
| 48 virtual void PrepareForChange() OVERRIDE; |
| 49 virtual void OnItemRemoved(int index) OVERRIDE; |
| 50 virtual void OnItemAdded(int index) OVERRIDE; |
| 51 virtual void ChangesDone() OVERRIDE; |
| 52 |
| 53 private: |
| 54 int ModelIndexToMenuItemId(int model_index) const; |
| 55 int MenuItemIdToModelIndex(int menu_item_id) const; |
| 56 |
| 57 MenuItemsChangedDelegate* items_changed_delegate_; |
| 58 RecentTabsSubMenuModel* model_; |
| 59 views::MenuItemView* menu_item_; |
| 60 int first_command_id_; |
| 61 int max_command_id_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(RecentTabsMenuModelDelegate); |
| 64 }; |
| 65 |
| 66 #endif // CHROME_BROWSER_UI_VIEWS_RECENT_TABS_MENU_MODEL_DELEGATE_H_ |
| OLD | NEW |