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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 ALWAYS_OPEN_TYPE, // Default this file extension to always open. | 30 ALWAYS_OPEN_TYPE, // Default this file extension to always open. |
31 PLATFORM_OPEN, // Open using platform handler. | 31 PLATFORM_OPEN, // Open using platform handler. |
32 CANCEL, // Cancel the download. | 32 CANCEL, // Cancel the download. |
33 TOGGLE_PAUSE, // Pause or resume a download. | 33 TOGGLE_PAUSE, // Pause or resume a download. |
34 DISCARD, // Discard the malicious download. | 34 DISCARD, // Discard the malicious download. |
35 KEEP, // Keep the malicious download. | 35 KEEP, // Keep the malicious download. |
36 LEARN_MORE_SCANNING, // Show information about download scanning. | 36 LEARN_MORE_SCANNING, // Show information about download scanning. |
37 LEARN_MORE_INTERRUPTED,// Show information about interrupted downloads. | 37 LEARN_MORE_INTERRUPTED,// Show information about interrupted downloads. |
38 }; | 38 }; |
39 | 39 |
40 virtual ~DownloadShelfContextMenu(); | 40 ~DownloadShelfContextMenu() override; |
41 | 41 |
42 content::DownloadItem* download_item() const { return download_item_; } | 42 content::DownloadItem* download_item() const { return download_item_; } |
43 | 43 |
44 protected: | 44 protected: |
45 DownloadShelfContextMenu(content::DownloadItem* download_item, | 45 DownloadShelfContextMenu(content::DownloadItem* download_item, |
46 content::PageNavigator* navigator); | 46 content::PageNavigator* navigator); |
47 | 47 |
48 // Returns the correct menu model depending on the state of the download item. | 48 // Returns the correct menu model depending on the state of the download item. |
49 // Returns NULL if the download was destroyed. | 49 // Returns NULL if the download was destroyed. |
50 ui::SimpleMenuModel* GetMenuModel(); | 50 ui::SimpleMenuModel* GetMenuModel(); |
51 | 51 |
52 // ui::SimpleMenuModel::Delegate: | 52 // ui::SimpleMenuModel::Delegate: |
53 virtual bool IsCommandIdEnabled(int command_id) const override; | 53 bool IsCommandIdEnabled(int command_id) const override; |
54 virtual bool IsCommandIdChecked(int command_id) const override; | 54 bool IsCommandIdChecked(int command_id) const override; |
55 virtual bool IsCommandIdVisible(int command_id) const override; | 55 bool IsCommandIdVisible(int command_id) const override; |
56 virtual void ExecuteCommand(int command_id, int event_flags) override; | 56 void ExecuteCommand(int command_id, int event_flags) override; |
57 virtual bool GetAcceleratorForCommandId( | 57 bool GetAcceleratorForCommandId(int command_id, |
58 int command_id, | 58 ui::Accelerator* accelerator) override; |
59 ui::Accelerator* accelerator) override; | 59 bool IsItemForCommandIdDynamic(int command_id) const override; |
60 virtual bool IsItemForCommandIdDynamic(int command_id) const override; | 60 base::string16 GetLabelForCommandId(int command_id) const override; |
61 virtual base::string16 GetLabelForCommandId(int command_id) const override; | |
62 | 61 |
63 private: | 62 private: |
64 // Detaches self from |download_item_|. Called when the DownloadItem is | 63 // Detaches self from |download_item_|. Called when the DownloadItem is |
65 // destroyed or when this object is being destroyed. | 64 // destroyed or when this object is being destroyed. |
66 void DetachFromDownloadItem(); | 65 void DetachFromDownloadItem(); |
67 | 66 |
68 // content::DownloadItem::Observer | 67 // content::DownloadItem::Observer |
69 virtual void OnDownloadDestroyed(content::DownloadItem* download) override; | 68 void OnDownloadDestroyed(content::DownloadItem* download) override; |
70 | 69 |
71 ui::SimpleMenuModel* GetInProgressMenuModel(); | 70 ui::SimpleMenuModel* GetInProgressMenuModel(); |
72 ui::SimpleMenuModel* GetFinishedMenuModel(); | 71 ui::SimpleMenuModel* GetFinishedMenuModel(); |
73 ui::SimpleMenuModel* GetInterruptedMenuModel(); | 72 ui::SimpleMenuModel* GetInterruptedMenuModel(); |
74 ui::SimpleMenuModel* GetMaybeMaliciousMenuModel(); | 73 ui::SimpleMenuModel* GetMaybeMaliciousMenuModel(); |
75 ui::SimpleMenuModel* GetMaliciousMenuModel(); | 74 ui::SimpleMenuModel* GetMaliciousMenuModel(); |
76 | 75 |
77 int GetAlwaysOpenStringId() const; | 76 int GetAlwaysOpenStringId() const; |
78 | 77 |
79 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
(...skipping 16 matching lines...) Expand all Loading... |
96 content::PageNavigator* navigator_; | 95 content::PageNavigator* navigator_; |
97 | 96 |
98 #if defined(OS_WIN) | 97 #if defined(OS_WIN) |
99 bool is_pdf_reader_up_to_date_; | 98 bool is_pdf_reader_up_to_date_; |
100 #endif | 99 #endif |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); | 101 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); |
103 }; | 102 }; |
104 | 103 |
105 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ | 104 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ |
OLD | NEW |