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

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

Issue 1084123004: [Downloads] Add context parameter to help center article URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « chrome/browser/download/download_commands.h ('k') | chrome/browser/download/download_commands_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_commands.cc
diff --git a/chrome/browser/download/download_commands.cc b/chrome/browser/download/download_commands.cc
index 97784977e39b20f3f88b82ed0210bc26bebca988..d571907609d85bbe39e03578f2b094781e295a14 100644
--- a/chrome/browser/download/download_commands.cc
+++ b/chrome/browser/download/download_commands.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/download/download_commands.h"
+#include "base/strings/stringprintf.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_crx_util.h"
#include "chrome/browser/download/download_item_model.h"
@@ -15,7 +16,9 @@
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
+#include "components/google/core/browser/google_util.h"
#include "grit/theme_resources.h"
+#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -29,7 +32,7 @@ DownloadCommands::DownloadCommands(content::DownloadItem* download_item)
DCHECK(download_item);
}
-int DownloadCommands::GetCommandIconId(Command command) {
+int DownloadCommands::GetCommandIconId(Command command) const {
switch (command) {
case PAUSE:
return IDR_DOWNLOAD_NOTIFICATION_MENU_PAUSE;
@@ -58,6 +61,16 @@ int DownloadCommands::GetCommandIconId(Command command) {
return -1;
}
+GURL DownloadCommands::GetLearnMoreURLForInterruptedDownload() const {
+ GURL learn_more_url(chrome::kDownloadInterruptedLearnMoreURL);
+ learn_more_url = google_util::AppendGoogleLocaleParam(
+ learn_more_url, g_browser_process->GetApplicationLocale());
+ return net::AppendQueryParameter(
+ learn_more_url, "ctx",
+ base::StringPrintf("%d",
+ static_cast<int>(download_item_->GetLastReason())));
+}
+
gfx::Image DownloadCommands::GetCommandIcon(Command command) {
ResourceBundle& bundle = ResourceBundle::GetSharedInstance();
return bundle.GetImageNamed(GetCommandIconId(command));
@@ -194,7 +207,7 @@ void DownloadCommands::ExecuteCommand(Command command) {
}
case LEARN_MORE_INTERRUPTED:
GetBrowser()->OpenURL(content::OpenURLParams(
- GURL(chrome::kDownloadInterruptedLearnMoreURL), content::Referrer(),
+ GetLearnMoreURLForInterruptedDownload(), content::Referrer(),
NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false));
break;
case PAUSE:
« no previous file with comments | « chrome/browser/download/download_commands.h ('k') | chrome/browser/download/download_commands_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698