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

Unified Diff: chrome/browser/download/download_commands.cc

Issue 852043002: Initial Implementation of Download Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 11 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_commands.cc
diff --git a/chrome/browser/download/download_commands.cc b/chrome/browser/download/download_commands.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d3b04080a74b82036273231987cc45a6c4b2584
--- /dev/null
+++ b/chrome/browser/download/download_commands.cc
@@ -0,0 +1,55 @@
+// 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.
+
+#include "chrome/browser/download/download_commands.h"
+#include "chrome/grit/generated_resources.h"
+#include "grit/theme_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+base::string16 GetCommandText(DownloadCommands type) {
+ int string_id;
+ switch (type) {
+ case OPEN_WHEN_COMPLETE:
+ string_id = IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE;
+ break;
+ case PAUSE:
+ string_id = IDS_DOWNLOAD_LINK_PAUSE;
+ break;
+ case RESUME:
+ string_id = IDS_DOWNLOAD_LINK_RESUME;
+ break;
+ case SHOW_IN_FOLDER:
+ string_id = IDS_DOWNLOAD_LINK_SHOW;
+ break;
+ case RETRY:
+ string_id = IDS_DOWNLOAD_LINK_RETRY;
+ break;
+ case DISCARD:
+ string_id = IDS_DISCARD_DOWNLOAD;
+ break;
+ default:
asanka 2015/01/31 00:38:51 Don't use a 'default' clause. The compiler will wa
+ // TODO
+ return base::string16();
+ }
+ return l10n_util::GetStringUTF16(string_id);
+}
+
+int GetCommandIconId(DownloadCommands type) {
+ switch (type) {
+ case OPEN_WHEN_COMPLETE:
+ return -1;
+ case PAUSE:
+ return IDR_DOWNLOAD_NOTIFICATION_MENU_PAUSE;
+ case RESUME:
+ return IDR_DOWNLOAD_NOTIFICATION_MENU_RESUME;
+ case SHOW_IN_FOLDER:
+ return IDR_DOWNLOAD_NOTIFICATION_MENU_FOLDER;
+ case RETRY:
+ return IDR_DOWNLOAD_NOTIFICATION_MENU_DOWNLOAD;
+ case DISCARD:
+ return IDR_DOWNLOAD_NOTIFICATION_MENU_DELETE;
+ default:
asanka 2015/01/31 00:38:51 Ditto.
+ return -1;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698