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

Unified Diff: chrome/browser/platform_util_linux.cc

Issue 352393002: Be explicit about target type in platform_util::OpenItem() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify Chrome OS change. Created 6 years, 3 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/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) {

Powered by Google App Engine
This is Rietveld 408576698