Index: chrome/browser/platform_util_linux.cc |
diff --git a/chrome/browser/platform_util_linux.cc b/chrome/browser/platform_util_linux.cc |
index a263b835e8300652cffcbbc56dda57b1e6d950cc..5d2b0747c87f4e2013b526918fa94e560e864867 100644 |
--- a/chrome/browser/platform_util_linux.cc |
+++ b/chrome/browser/platform_util_linux.cc |
@@ -50,15 +50,16 @@ void XDGEmail(const std::string& email) { |
XDGUtil("xdg-email", email); |
} |
-// TODO(estade): It would be nice to be able to select the file in the file |
-// manager, but that probably requires extending xdg-open. For now just |
-// show the folder. |
-void ShowItemInFolderOnFileThread(const base::FilePath& full_path) { |
- base::FilePath dir = full_path.DirName(); |
- if (!base::DirectoryExists(dir)) |
+void OpenFileOnFileThread(const base::FilePath& full_path) { |
+ if (!base::PathExists(full_path) || base::DirectoryExists(full_path)) |
return; |
+ XDGOpen(full_path.value()); |
+} |
- XDGOpen(dir.value()); |
+void OpenFolderOnFileThread(const base::FilePath& full_path) { |
+ if (!base::DirectoryExists(full_path)) |
+ return; |
+ XDGOpen(full_path.value()); |
} |
} // namespace |
@@ -67,14 +68,27 @@ namespace platform_util { |
void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
- base::Bind(&ShowItemInFolderOnFileThread, full_path)); |
+ // TODO(estade): It would be nice to be able to select the file in the file |
+ // manager, but that probably requires extending xdg-open. For now just show |
+ // the folder. |
+ BrowserThread::PostTask( |
+ BrowserThread::FILE, |
+ FROM_HERE, |
+ base::Bind(&OpenFolderOnFileThread, full_path.DirName())); |
+} |
+ |
+void OpenFile(Profile* profile, const base::FilePath& full_path) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ BrowserThread::PostTask(BrowserThread::FILE, |
+ FROM_HERE, |
+ base::Bind(&OpenFileOnFileThread, full_path)); |
} |
-void OpenItem(Profile* profile, const base::FilePath& full_path) { |
+void OpenFolder(Profile* profile, const base::FilePath& full_path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
- base::Bind(&XDGOpen, full_path.value())); |
+ BrowserThread::PostTask(BrowserThread::FILE, |
+ FROM_HERE, |
+ base::Bind(&OpenFolderOnFileThread, full_path)); |
} |
void OpenExternal(Profile* profile, const GURL& url) { |