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 81d7a4ebf3311d77a53bf6956957b7d4823b17af..f81bddcef735a57ec7f6f790da7a507ff00204e8 100644 |
--- a/chrome/browser/download/download_shelf_context_menu.cc |
+++ b/chrome/browser/download/download_shelf_context_menu.cc |
@@ -128,6 +128,12 @@ bool DownloadShelfContextMenu::IsCommandIdChecked(int command_id) const { |
download_item_->GetBrowserContext()); |
return prefs->ShouldOpenPdfInAdobeReader(); |
} |
+#elif defined(OS_MACOSX) || defined(OS_LINUX) |
+ if (CanOpenPdfInReader()) { |
+ DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext( |
+ download_item_->GetBrowserContext()); |
+ return prefs->ShouldOpenPdfInSystemReader(); |
+ } |
#endif |
return download_item_->ShouldOpenFileBasedOnExtension(); |
case TOGGLE_PAUSE: |
@@ -168,6 +174,13 @@ void DownloadShelfContextMenu::ExecuteCommand(int command_id, int event_flags) { |
is_checked); |
break; |
} |
+#elif defined(OS_MACOSX) || defined(OS_LINUX) |
+ if (CanOpenPdfInReader()) { |
+ prefs->SetShouldOpenPdfInSystemReader(!is_checked); |
+ DownloadItemModel(download_item_).SetShouldPreferOpeningInBrowser( |
+ is_checked); |
+ break; |
+ } |
#endif |
base::FilePath path = download_item_->GetTargetFilePath(); |
if (is_checked) |
@@ -388,17 +401,26 @@ int DownloadShelfContextMenu::GetAlwaysOpenStringId() const { |
#if defined(OS_WIN) |
if (CanOpenPdfInReader()) |
return IDS_DOWNLOAD_MENU_ALWAYS_OPEN_PDF_IN_READER; |
+#elif defined(OS_MACOSX) || defined(OS_LINUX) |
+ if (CanOpenPdfInReader()) |
+ return IDS_DOWNLOAD_MENU_PLATFORM_OPEN_ALWAYS; |
#endif |
return IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE; |
} |
-#if defined(OS_WIN) |
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
bool DownloadShelfContextMenu::IsDownloadPdf() const { |
base::FilePath path = download_item_->GetTargetFilePath(); |
return path.MatchesExtension(FILE_PATH_LITERAL(".pdf")); |
} |
+#endif |
+#if defined(OS_WIN) |
bool DownloadShelfContextMenu::CanOpenPdfInReader() const { |
return (is_pdf_reader_up_to_date_ && IsDownloadPdf()); |
} |
+#elif defined(OS_MACOSX) || defined(OS_LINUX) |
+bool DownloadShelfContextMenu::CanOpenPdfInReader() const { |
+ return IsDownloadPdf(); |
+} |
#endif |