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

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

Issue 55063002: Prefer opening PDF downloads in the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reorganize some code to address comments. Created 7 years, 1 month 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_shelf_context_menu.cc
diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc
index d2fc2564e87015459297aebe430886d67495338e..a665db344877127f0a3248acd4f32a11c9a3573c 100644
--- a/chrome/browser/download/download_shelf_context_menu.cc
+++ b/chrome/browser/download/download_shelf_context_menu.cc
@@ -79,6 +79,7 @@ bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
case SHOW_IN_FOLDER:
return download_item_->CanShowInFolder();
case OPEN_WHEN_COMPLETE:
+ case PLATFORM_OPEN:
return download_item_->CanOpenDownload() &&
!download_crx_util::IsExtensionDownload(*download_item_);
case ALWAYS_OPEN_TYPE:
@@ -138,6 +139,9 @@ void DownloadShelfContextMenu::ExecuteCommand(int command_id, int event_flags) {
prefs->DisableAutoOpenBasedOnExtension(path);
break;
}
+ case PLATFORM_OPEN:
+ DownloadItemModel(download_item_).OpenUsingPlatformHandler();
+ break;
case CANCEL:
download_item_->Cancel(true /* Cancelled by user */);
break;
@@ -221,6 +225,8 @@ string16 DownloadShelfContextMenu::GetLabelForCommandId(int command_id) const {
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN);
case ALWAYS_OPEN_TYPE:
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
+ case PLATFORM_OPEN:
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_PLATFORM_OPEN);
case CANCEL:
return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_CANCEL);
case TOGGLE_PAUSE:
@@ -290,6 +296,9 @@ ui::SimpleMenuModel* DownloadShelfContextMenu::GetFinishedMenuModel() {
OPEN_WHEN_COMPLETE, IDS_DOWNLOAD_MENU_OPEN);
finished_download_menu_model_->AddCheckItemWithStringId(
ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
+ if (DownloadItemModel(download_item_).ShouldPreferOpeningInBrowser())
+ finished_download_menu_model_->AddItemWithStringId(
+ PLATFORM_OPEN, IDS_DOWNLOAD_MENU_PLATFORM_OPEN);
finished_download_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR);
finished_download_menu_model_->AddItemWithStringId(
SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);

Powered by Google App Engine
This is Rietveld 408576698