| Index: chrome/browser/ui/tabs/recently_closed_tabs_menu_model.h
|
| ===================================================================
|
| --- chrome/browser/ui/tabs/recently_closed_tabs_menu_model.h (revision 0)
|
| +++ chrome/browser/ui/tabs/recently_closed_tabs_menu_model.h (revision 0)
|
| @@ -0,0 +1,84 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_UI_TABS_RECENTLY_CLOSED_TABS_MENU_MODEL_H_
|
| +#define CHROME_BROWSER_UI_TABS_RECENTLY_CLOSED_TABS_MENU_MODEL_H_
|
| +#pragma once
|
| +
|
| +#include <set>
|
| +#include <string>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/gtest_prod_util.h"
|
| +#include "base/string16.h"
|
| +#include "chrome/browser/favicon/favicon_service.h"
|
| +#include "ui/base/models/menu_model.h"
|
| +#include "webkit/glue/window_open_disposition.h"
|
| +#include "chrome/browser/sessions/tab_restore_service.h"
|
| +
|
| +class Browser;
|
| +class TabRestoreService;
|
| +
|
| +namespace gfx {
|
| +class ImageSkia;
|
| +}
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +//
|
| +// RecentlyClosedTabsMenuModel
|
| +//
|
| +// Interface for the showing of the dropdown menu for the newtab button.
|
| +// Actual implementations are platform-specific.
|
| +///////////////////////////////////////////////////////////////////////////////
|
| +class RecentlyClosedTabsMenuModel : public ui::MenuModel {
|
| + public:
|
| + explicit RecentlyClosedTabsMenuModel(Browser* browser);
|
| + virtual ~RecentlyClosedTabsMenuModel();
|
| +
|
| + // MenuModel implementation.
|
| + virtual bool HasIcons() const OVERRIDE;
|
| + // Returns total number of items the menu should show.
|
| + virtual int GetItemCount() const OVERRIDE;
|
| + virtual ItemType GetTypeAt(int index) const OVERRIDE;
|
| + virtual int GetCommandIdAt(int index) const OVERRIDE;
|
| + virtual string16 GetLabelAt(int index) const OVERRIDE;
|
| + virtual bool IsItemDynamicAt(int index) const OVERRIDE;
|
| + virtual bool GetAcceleratorAt(int index,
|
| + ui::Accelerator* accelerator) const OVERRIDE;
|
| + virtual bool IsItemCheckedAt(int index) const OVERRIDE;
|
| + virtual int GetGroupIdAt(int index) const OVERRIDE;
|
| + virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE;
|
| + virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(
|
| + int index) const OVERRIDE;
|
| + virtual bool IsEnabledAt(int index) const OVERRIDE;
|
| + virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE;
|
| + virtual void HighlightChangedTo(int index) OVERRIDE;
|
| + virtual void ActivatedAt(int index) OVERRIDE;
|
| + virtual void ActivatedAt(int index, int event_flags) OVERRIDE;
|
| + virtual void MenuWillShow() OVERRIDE;
|
| +
|
| + // Set the delegate for triggering OnIconChanged.
|
| + virtual void SetMenuModelDelegate(
|
| + ui::MenuModelDelegate* menu_model_delegate) OVERRIDE;
|
| +
|
| + protected:
|
| + ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; }
|
| +
|
| + private:
|
| + TabRestoreService::Entry* GetNavigationEntryAt(int index) const;
|
| +
|
| + int GetRecentlyClosedItemCount() const;
|
| +
|
| + Browser* browser_;
|
| +
|
| + // TabRestoreService that we are observing.
|
| + TabRestoreService* tab_restore_service_;
|
| +
|
| + // Used for receiving notifications when an icon is changed.
|
| + ui::MenuModelDelegate* menu_model_delegate_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(RecentlyClosedTabsMenuModel);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_UI_TABS_RECENTLY_CLOSED_TABS_MENU_MODEL_H_
|
|
|