OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMMAND_H_ | |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMMAND_H_ | |
7 | |
8 #include "base/strings/string16.h" | |
9 | |
10 #include "content/public/browser/download_item.h" | |
11 #include "content/public/browser/page_navigator.h" | |
12 | |
13 class DownloadCommand { | |
asanka
2015/02/10 02:25:30
Given how it's used, I'd probably go with Download
yoshiki
2015/02/10 17:49:17
Thanks for guidance. Done.
| |
14 public: | |
15 enum Commands { | |
16 SHOW_IN_FOLDER = 1, // Open a folder view window with the item selected. | |
17 OPEN_WHEN_COMPLETE, // Open the download when it's finished. | |
18 ALWAYS_OPEN_TYPE, // Default this file extension to always open. | |
19 PLATFORM_OPEN, // Open using platform handler. | |
20 CANCEL, // Cancel the download. | |
21 PAUSE, // Pause a download. | |
22 RESUME, // Resume a download. | |
23 DISCARD, // Discard the malicious download. | |
24 KEEP, // Keep the malicious download. | |
25 RETRY, // Retry the download. | |
26 LEARN_MORE_SCANNING, // Show information about download scanning. | |
27 LEARN_MORE_INTERRUPTED,// Show information about interrupted downloads. | |
28 }; | |
29 | |
30 explicit DownloadCommand(content::DownloadItem* download_item); | |
31 virtual ~DownloadCommand() {} | |
32 | |
33 int GetCommandIconId(Commands type); | |
asanka
2015/02/10 02:25:30
Taken out of context, methods that return string I
yoshiki
2015/02/10 17:49:17
I made these public methods return string16/Image
| |
34 | |
35 int GetCommandStringId(Commands type) const; | |
36 int GetCommandStringIdForMenu(Commands type) const; | |
37 | |
38 bool IsCommandIdEnabled(Commands command_id) const; | |
39 bool IsCommandIdChecked(Commands command_id) const; | |
40 bool IsCommandIdVisible(Commands command_id) const; | |
41 void ExecuteCommand(Commands command_id, content::PageNavigator* navigator); | |
42 | |
43 private: | |
44 #if defined(OS_WIN) || defined(OS_LINUX) || \ | |
45 (defined(OS_MACOSX) && !defined(OS_IOS)) | |
46 bool IsDownloadPdf() const; | |
47 bool CanOpenPdfInSystemViewer() const; | |
48 #endif | |
49 | |
50 int GetCommandStringIdInternal(Commands type, bool for_menu) const; | |
51 | |
52 int GetAlwaysOpenStringId() const; | |
53 | |
54 content::DownloadItem* download_item_; | |
55 }; | |
56 | |
57 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMMAND_H_ | |
OLD | NEW |