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

Unified Diff: chrome/browser/ui/tabs/recently_closed_tabs_menu_model.h

Issue 10561003: Implementaion for showing recently closed tabs list on right clicking new tab button. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc ('k') | chrome/browser/ui/tabs/recently_closed_tabs_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698