OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 }; | 29 }; |
30 | 30 |
31 virtual ~DownloadShelfContextMenu(); | 31 virtual ~DownloadShelfContextMenu(); |
32 | 32 |
33 DownloadItem* download_item() const { return download_item_; } | 33 DownloadItem* download_item() const { return download_item_; } |
34 void set_download_item(DownloadItem* item) { download_item_ = item; } | 34 void set_download_item(DownloadItem* item) { download_item_ = item; } |
35 | 35 |
36 protected: | 36 protected: |
37 explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model); | 37 explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model); |
38 | 38 |
39 ui::SimpleMenuModel* GetInProgressMenuModel(); | 39 // Returns the correct menu model depending whether the download item is |
40 ui::SimpleMenuModel* GetFinishedMenuModel(); | 40 // completed or not. |
| 41 ui::SimpleMenuModel* GetMenuModel(); |
41 | 42 |
42 // ui::SimpleMenuModel::Delegate: | 43 // ui::SimpleMenuModel::Delegate: |
43 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 44 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
44 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 45 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
45 virtual void ExecuteCommand(int command_id) OVERRIDE; | 46 virtual void ExecuteCommand(int command_id) OVERRIDE; |
46 virtual bool GetAcceleratorForCommandId( | 47 virtual bool GetAcceleratorForCommandId( |
47 int command_id, | 48 int command_id, |
48 ui::Accelerator* accelerator) OVERRIDE; | 49 ui::Accelerator* accelerator) OVERRIDE; |
49 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 50 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; |
50 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 51 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; |
51 | 52 |
52 private: | 53 private: |
| 54 ui::SimpleMenuModel* GetInProgressMenuModel(); |
| 55 ui::SimpleMenuModel* GetFinishedMenuModel(); |
| 56 |
53 // We show slightly different menus if the download is in progress vs. if the | 57 // We show slightly different menus if the download is in progress vs. if the |
54 // download has finished. | 58 // download has finished. |
55 scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_; | 59 scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_; |
56 scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_; | 60 scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_; |
57 | 61 |
58 // A model to control the cancel behavior. | 62 // A model to control the cancel behavior. |
59 BaseDownloadItemModel* download_model_; | 63 BaseDownloadItemModel* download_model_; |
60 | 64 |
61 // Information source. | 65 // Information source. |
62 DownloadItem* download_item_; | 66 DownloadItem* download_item_; |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); | 68 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); |
65 }; | 69 }; |
66 | 70 |
67 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ | 71 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ |
OLD | NEW |