diff options
author | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 21:35:22 +0000 |
---|---|---|
committer | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 21:35:22 +0000 |
commit | 7c3228a4dc63c1c818a135c619fe256b91bf3989 (patch) | |
tree | 0f721dc2645eda906f8dfee9d0a199f8a1c95a89 /chrome/browser/platform_util_linux.cc | |
parent | 2f3eff4cc24b0b6a210103cbfb1a9d6a6a080af5 (diff) | |
download | chromium_src-7c3228a4dc63c1c818a135c619fe256b91bf3989.zip chromium_src-7c3228a4dc63c1c818a135c619fe256b91bf3989.tar.gz chromium_src-7c3228a4dc63c1c818a135c619fe256b91bf3989.tar.bz2 |
platform_util OpenItem/ShowItemInFolder threading fixes.
OpenItem and ShowItemInFolder must now be called from the UI thread only - add
a comment to this effect in the header.
Dispatch the implementations to the FILE thread on chromeos/win/linux.
Fix usage of OpenItem/ShowItemInFolder in DownloadsDomHandler and
ChromeContentBrowserClient.
Rename ShowFullTabUrl to ViewFolder and get rid of unused Profile* arg.
Use anonymous namespace for functions in file_manager_util.cc and platform_util_chromeos.cc
Replace NewRunnableFunction with Bind.
Add additional threading DCHECKs.
Fix lint errors.
BUG=chromium-os:21585
TEST=go to downloads page (ctrl-j), click on Open Downloads Folder.
Review URL: http://codereview.chromium.org/8457004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/platform_util_linux.cc')
-rw-r--r-- | chrome/browser/platform_util_linux.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/platform_util_linux.cc b/chrome/browser/platform_util_linux.cc index e93cc0f..e0a0b94 100644 --- a/chrome/browser/platform_util_linux.cc +++ b/chrome/browser/platform_util_linux.cc @@ -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 @@ void XDGEmail(const std::string& email) { 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 @@ void ShowItemInFolder(const FilePath& full_path) { 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) { |