| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 54 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 54 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 55 virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; |
| 55 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 56 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
| 56 virtual bool GetAcceleratorForCommandId( | 57 virtual bool GetAcceleratorForCommandId( |
| 57 int command_id, | 58 int command_id, |
| 58 ui::Accelerator* accelerator) OVERRIDE; | 59 ui::Accelerator* accelerator) OVERRIDE; |
| 59 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 60 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; |
| 60 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 61 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 // Detaches self from |download_item_|. Called when the DownloadItem is | 64 // Detaches self from |download_item_|. Called when the DownloadItem is |
| 64 // destroyed or when this object is being destroyed. | 65 // destroyed or when this object is being destroyed. |
| 65 void DetachFromDownloadItem(); | 66 void DetachFromDownloadItem(); |
| 66 | 67 |
| 67 // content::DownloadItem::Observer | 68 // content::DownloadItem::Observer |
| 68 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; | 69 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; |
| 69 | 70 |
| 70 ui::SimpleMenuModel* GetInProgressMenuModel(); | 71 ui::SimpleMenuModel* GetInProgressMenuModel(); |
| 71 ui::SimpleMenuModel* GetFinishedMenuModel(); | 72 ui::SimpleMenuModel* GetFinishedMenuModel(); |
| 72 ui::SimpleMenuModel* GetInterruptedMenuModel(); | 73 ui::SimpleMenuModel* GetInterruptedMenuModel(); |
| 73 ui::SimpleMenuModel* GetMaybeMaliciousMenuModel(); | 74 ui::SimpleMenuModel* GetMaybeMaliciousMenuModel(); |
| 74 ui::SimpleMenuModel* GetMaliciousMenuModel(); | 75 ui::SimpleMenuModel* GetMaliciousMenuModel(); |
| 75 | 76 |
| 77 int GetAlwaysOpenStringId() const; |
| 78 |
| 79 #if defined(OS_WIN) |
| 80 bool IsDownloadPdf() const; |
| 81 bool CanOpenPdfInReader() const; |
| 82 #endif |
| 83 |
| 76 // We show slightly different menus if the download is in progress vs. if the | 84 // We show slightly different menus if the download is in progress vs. if the |
| 77 // download has finished. | 85 // download has finished. |
| 78 scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_; | 86 scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_; |
| 79 scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_; | 87 scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_; |
| 80 scoped_ptr<ui::SimpleMenuModel> interrupted_download_menu_model_; | 88 scoped_ptr<ui::SimpleMenuModel> interrupted_download_menu_model_; |
| 81 scoped_ptr<ui::SimpleMenuModel> maybe_malicious_download_menu_model_; | 89 scoped_ptr<ui::SimpleMenuModel> maybe_malicious_download_menu_model_; |
| 82 scoped_ptr<ui::SimpleMenuModel> malicious_download_menu_model_; | 90 scoped_ptr<ui::SimpleMenuModel> malicious_download_menu_model_; |
| 83 | 91 |
| 84 // Information source. | 92 // Information source. |
| 85 content::DownloadItem* download_item_; | 93 content::DownloadItem* download_item_; |
| 86 | 94 |
| 87 // Used to open tabs. | 95 // Used to open tabs. |
| 88 content::PageNavigator* navigator_; | 96 content::PageNavigator* navigator_; |
| 89 | 97 |
| 98 #if defined(OS_WIN) |
| 99 bool is_pdf_reader_up_to_date_; |
| 100 #endif |
| 101 |
| 90 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); | 102 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); |
| 91 }; | 103 }; |
| 92 | 104 |
| 93 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ | 105 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ |
| OLD | NEW |