Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1658)

Unified Diff: chrome/browser/download/download_command.h

Issue 852043002: Initial Implementation of Download Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor bug fix. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_command.h
diff --git a/chrome/browser/download/download_command.h b/chrome/browser/download/download_command.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b7821f3aa275e760a2083d505d4015cffbaa104
--- /dev/null
+++ b/chrome/browser/download/download_command.h
@@ -0,0 +1,57 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMMAND_H_
+#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMMAND_H_
+
+#include "base/strings/string16.h"
+
+#include "content/public/browser/download_item.h"
+#include "content/public/browser/page_navigator.h"
+
+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.
+ public:
+ enum Commands {
+ SHOW_IN_FOLDER = 1, // Open a folder view 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.
+ PLATFORM_OPEN, // Open using platform handler.
+ CANCEL, // Cancel the download.
+ PAUSE, // Pause a download.
+ RESUME, // Resume a download.
+ DISCARD, // Discard the malicious download.
+ KEEP, // Keep the malicious download.
+ RETRY, // Retry the download.
+ LEARN_MORE_SCANNING, // Show information about download scanning.
+ LEARN_MORE_INTERRUPTED,// Show information about interrupted downloads.
+ };
+
+ explicit DownloadCommand(content::DownloadItem* download_item);
+ virtual ~DownloadCommand() {}
+
+ 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
+
+ int GetCommandStringId(Commands type) const;
+ int GetCommandStringIdForMenu(Commands type) const;
+
+ bool IsCommandIdEnabled(Commands command_id) const;
+ bool IsCommandIdChecked(Commands command_id) const;
+ bool IsCommandIdVisible(Commands command_id) const;
+ void ExecuteCommand(Commands command_id, content::PageNavigator* navigator);
+
+ private:
+#if defined(OS_WIN) || defined(OS_LINUX) || \
+ (defined(OS_MACOSX) && !defined(OS_IOS))
+ bool IsDownloadPdf() const;
+ bool CanOpenPdfInSystemViewer() const;
+#endif
+
+ int GetCommandStringIdInternal(Commands type, bool for_menu) const;
+
+ int GetAlwaysOpenStringId() const;
+
+ content::DownloadItem* download_item_;
+};
+
+#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMMAND_H_

Powered by Google App Engine
This is Rietveld 408576698