| 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_TABS_RECENTLY_CLOSED_TABS_MENU_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_TABS_RECENTLY_CLOSED_TABS_MENU_MODEL_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/string16.h" |
| 15 #include "chrome/browser/favicon/favicon_service.h" |
| 16 #include "ui/base/models/menu_model.h" |
| 17 #include "webkit/glue/window_open_disposition.h" |
| 18 #include "chrome/browser/sessions/tab_restore_service.h" |
| 19 |
| 20 class Browser; |
| 21 class TabRestoreService; |
| 22 |
| 23 namespace gfx { |
| 24 class ImageSkia; |
| 25 } |
| 26 |
| 27 /////////////////////////////////////////////////////////////////////////////// |
| 28 // |
| 29 // RecentlyClosedTabsMenuModel |
| 30 // |
| 31 // Interface for the showing of the dropdown menu for the newtab button. |
| 32 // Actual implementations are platform-specific. |
| 33 /////////////////////////////////////////////////////////////////////////////// |
| 34 class RecentlyClosedTabsMenuModel : public ui::MenuModel { |
| 35 public: |
| 36 explicit RecentlyClosedTabsMenuModel(Browser* browser); |
| 37 virtual ~RecentlyClosedTabsMenuModel(); |
| 38 |
| 39 // MenuModel implementation. |
| 40 virtual bool HasIcons() const OVERRIDE; |
| 41 // Returns total number of items the menu should show. |
| 42 virtual int GetItemCount() const OVERRIDE; |
| 43 virtual ItemType GetTypeAt(int index) const OVERRIDE; |
| 44 virtual int GetCommandIdAt(int index) const OVERRIDE; |
| 45 virtual string16 GetLabelAt(int index) const OVERRIDE; |
| 46 virtual bool IsItemDynamicAt(int index) const OVERRIDE; |
| 47 virtual bool GetAcceleratorAt(int index, |
| 48 ui::Accelerator* accelerator) const OVERRIDE; |
| 49 virtual bool IsItemCheckedAt(int index) const OVERRIDE; |
| 50 virtual int GetGroupIdAt(int index) const OVERRIDE; |
| 51 virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE; |
| 52 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
| 53 int index) const OVERRIDE; |
| 54 virtual bool IsEnabledAt(int index) const OVERRIDE; |
| 55 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; |
| 56 virtual void HighlightChangedTo(int index) OVERRIDE; |
| 57 virtual void ActivatedAt(int index) OVERRIDE; |
| 58 virtual void ActivatedAt(int index, int event_flags) OVERRIDE; |
| 59 virtual void MenuWillShow() OVERRIDE; |
| 60 |
| 61 // Set the delegate for triggering OnIconChanged. |
| 62 virtual void SetMenuModelDelegate( |
| 63 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; |
| 64 |
| 65 protected: |
| 66 ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } |
| 67 |
| 68 private: |
| 69 TabRestoreService::Entry* GetNavigationEntryAt(int index) const; |
| 70 |
| 71 int GetRecentlyClosedItemCount() const; |
| 72 |
| 73 Browser* browser_; |
| 74 |
| 75 // TabRestoreService that we are observing. |
| 76 TabRestoreService* tab_restore_service_; |
| 77 |
| 78 // Used for receiving notifications when an icon is changed. |
| 79 ui::MenuModelDelegate* menu_model_delegate_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(RecentlyClosedTabsMenuModel); |
| 82 }; |
| 83 |
| 84 #endif // CHROME_BROWSER_UI_TABS_RECENTLY_CLOSED_TABS_MENU_MODEL_H_ |
| OLD | NEW |