Index: chrome/browser/platform_util_linux.cc |
=================================================================== |
--- chrome/browser/platform_util_linux.cc (revision 108954) |
+++ chrome/browser/platform_util_linux.cc (working copy) |
@@ -6,12 +6,16 @@ |
#include <gtk/gtk.h> |
+#include "base/bind.h" |
#include "base/file_util.h" |
#include "base/process_util.h" |
#include "base/utf_string_conversions.h" |
#include "content/common/process_watcher.h" |
+#include "content/public/browser/browser_thread.h" |
#include "googleurl/src/gurl.h" |
+using content::BrowserThread; |
+ |
namespace { |
void XDGUtil(const std::string& util, const std::string& arg) { |
@@ -58,15 +62,25 @@ |
// manager, but that probably requires extending xdg-open. For now just |
// show the folder. |
void ShowItemInFolder(const FilePath& full_path) { |
- FilePath dir = full_path.DirName(); |
- if (!file_util::DirectoryExists(dir)) |
- return; |
+ if (BrowserThread::CurrentlyOn(BrowserThread::FILE)) { |
+ FilePath dir = full_path.DirName(); |
+ if (!file_util::DirectoryExists(dir)) |
+ return; |
- XDGOpen(dir.value()); |
+ XDGOpen(dir.value()); |
+ } else { |
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&ShowItemInFolder, full_path)); |
+ } |
} |
void OpenItem(const FilePath& full_path) { |
- XDGOpen(full_path.value()); |
+ if (BrowserThread::CurrentlyOn(BrowserThread::FILE)) { |
+ XDGOpen(full_path.value()); |
+ } else { |
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&OpenItem, full_path)); |
+ } |
} |
void OpenExternal(const GURL& url) { |