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

Unified Diff: chrome/browser/platform_util_linux.cc

Issue 8457004: platform_util::OpenItem fixes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: update comments Created 9 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/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) {
@@ -50,14 +54,10 @@
XDGUtil("xdg-email", email);
}
-} // namespace
-
-namespace platform_util {
-
// 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 ShowItemInFolder(const FilePath& full_path) {
+void ShowItemInFolderOnFileThread(const FilePath& full_path) {
FilePath dir = full_path.DirName();
if (!file_util::DirectoryExists(dir))
return;
@@ -65,8 +65,20 @@
XDGOpen(dir.value());
}
+} // namespace
+
+namespace platform_util {
+
+void ShowItemInFolder(const FilePath& full_path) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ base::Bind(&ShowItemInFolderOnFileThread, full_path));
+}
+
void OpenItem(const FilePath& full_path) {
- XDGOpen(full_path.value());
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ base::Bind(&XDGOpen, full_path.value()));
}
void OpenExternal(const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698