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

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

Issue 665163005: Add option to open PDFs in system viewer to OS X and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unify the various identifiers for less #ifdefing. Created 6 years, 2 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_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..a1e4f7d7cf955d1d719424c9450bf1a31f754719 100644
--- a/chrome/browser/download/download_shelf_context_menu.cc
+++ b/chrome/browser/download/download_shelf_context_menu.cc
@@ -122,11 +122,12 @@ bool DownloadShelfContextMenu::IsCommandIdChecked(int command_id) const {
return download_item_->GetOpenWhenComplete() ||
download_crx_util::IsExtensionDownload(*download_item_);
case ALWAYS_OPEN_TYPE:
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX) || \
+ (defined(OS_MACOSX) && !defined(OS_IOS))
if (CanOpenPdfInReader()) {
DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(
download_item_->GetBrowserContext());
- return prefs->ShouldOpenPdfInAdobeReader();
+ return prefs->ShouldOpenPdfInSystemReader();
}
#endif
return download_item_->ShouldOpenFileBasedOnExtension();
@@ -161,9 +162,10 @@ void DownloadShelfContextMenu::ExecuteCommand(int command_id, int event_flags) {
bool is_checked = IsCommandIdChecked(ALWAYS_OPEN_TYPE);
DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(
download_item_->GetBrowserContext());
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX) || \
+ (defined(OS_MACOSX) && !defined(OS_IOS))
if (CanOpenPdfInReader()) {
- prefs->SetShouldOpenPdfInAdobeReader(!is_checked);
+ prefs->SetShouldOpenPdfInSystemReader(!is_checked);
DownloadItemModel(download_item_).SetShouldPreferOpeningInBrowser(
is_checked);
break;
@@ -388,17 +390,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 {
asanka 2014/10/23 07:38:04 CanOpenPdfInSystemViewer?
palmer 2014/10/23 22:17:08 OK, changed the name.
return (is_pdf_reader_up_to_date_ && IsDownloadPdf());
}
+#elif defined(OS_MACOSX) || defined(OS_LINUX)
+bool DownloadShelfContextMenu::CanOpenPdfInReader() const {
+ return IsDownloadPdf();
+}
#endif

Powered by Google App Engine
This is Rietveld 408576698