summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_shelf.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 00:43:44 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 00:43:44 +0000
commit8e3a815d1cf67f0e14a1b33431c9c9961b43fa79 (patch)
tree7947a494bc26dff0213b2b44cbbed131bb08e04f /chrome/browser/download/download_shelf.h
parent94f923b86617c2c6e7fda321256a7523096e3c51 (diff)
downloadchromium_src-8e3a815d1cf67f0e14a1b33431c9c9961b43fa79.zip
chromium_src-8e3a815d1cf67f0e14a1b33431c9c9961b43fa79.tar.gz
chromium_src-8e3a815d1cf67f0e14a1b33431c9c9961b43fa79.tar.bz2
Refactor the download shelf context menu in preparation for porting.
* Delete DownloadDestinationContextMenu, which is not used anywhere. * Delete the unused download menu item types from the ContextMenuCommands enum. * Merge BaseContextMenu and DownloadShelfContextMenu, move them from download_util.{h,cc} to download_shelf.{h,cc} * Take the windows-specific code from the new DownloadShelfContextMenu and put it in DownloadShelfContextMenuWin in download_item_view.cc (the only place it's used). DownloadShelfContextMenuWin extends DownloadShelfContextMenu and Menu::Delegate. Review URL: http://codereview.chromium.org/40184 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_shelf.h')
-rw-r--r--chrome/browser/download/download_shelf.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/download/download_shelf.h b/chrome/browser/download/download_shelf.h
index d3b83a1..6692fb8 100644
--- a/chrome/browser/download/download_shelf.h
+++ b/chrome/browser/download/download_shelf.h
@@ -5,9 +5,12 @@
#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
+#include <string>
+
#include "base/basictypes.h"
class BaseDownloadItemModel;
+class DownloadItem;
class TabContents;
// DownloadShelf is an interface for platform-specific download shelves to
@@ -47,5 +50,39 @@ class DownloadShelf {
DISALLOW_COPY_AND_ASSIGN(DownloadShelf);
};
+// Logic for the download shelf context menu. Platform specific subclasses are
+// responsible for creating and running the menu.
+class DownloadShelfContextMenu {
+ public:
+ virtual ~DownloadShelfContextMenu();
+
+ protected:
+ explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model);
+
+ enum ContextMenuCommands {
+ SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected
+ OPEN_WHEN_COMPLETE, // Open the download when it's finished
+ ALWAYS_OPEN_TYPE, // Default this file extension to always open
+ CANCEL, // Cancel the download
+ MENU_LAST
+ };
+
+ protected:
+ bool ItemIsChecked(int id) const;
+ bool ItemIsDefault(int id) const;
+ std::wstring GetItemLabel(int id) const;
+ bool IsItemCommandEnabled(int id) const;
+ void ExecuteItemCommand(int id);
+
+ // Information source.
+ DownloadItem* download_;
+
+ // A model to control the cancel behavior.
+ BaseDownloadItemModel* model_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu);
+};
+
#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_