Index: chrome/browser/platform_util_win.cc |
diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc |
index 657e80c52660754576aface0a83eb3f31dace26e..5b4c93076f95ca025dc7f015ca64ccefdc829bdb 100644 |
--- a/chrome/browser/platform_util_win.cc |
+++ b/chrome/browser/platform_util_win.cc |
@@ -11,6 +11,7 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
+#include "base/file_util.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/metrics/field_trial.h" |
@@ -166,6 +167,26 @@ void OpenItemViaShellInUtilityProcess(const base::FilePath& full_path) { |
utility_process_host->Send(new ChromeUtilityMsg_OpenItemViaShell(full_path)); |
} |
+void OpenFileOnFileThread(const base::FilePath& path) { |
+ if (base::DirectoryExists(path) || !base::PathExists(path)) |
+ return; |
+ if (base::FieldTrialList::FindFullName("IsolateShellOperations") == |
+ "Enabled") { |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, |
+ FROM_HERE, |
+ base::Bind(&OpenItemViaShellInUtilityProcess, path)); |
+ } else { |
+ ui::win::OpenItemViaShell(path); |
+ } |
+} |
+ |
+void OpenFolderOnFileThread(const base::FilePath& path) { |
+ if (!base::DirectoryExists(path)) |
+ return; |
+ ShellExecute(NULL, L"open", path.value().c_str(), NULL, NULL, SW_SHOW); |
+} |
+ |
} // namespace |
namespace platform_util { |
@@ -180,24 +201,26 @@ void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { |
base::Bind(&ShowItemInFolderOnFileThread, full_path)); |
} |
-void OpenItem(Profile* profile, const base::FilePath& full_path) { |
+void OpenFile(Profile* profile, const base::FilePath& full_path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING); |
- if (base::FieldTrialList::FindFullName("IsolateShellOperations") == |
- "Enabled") { |
- BrowserThread::PostTask( |
- BrowserThread::IO, |
- FROM_HERE, |
- base::Bind(&OpenItemViaShellInUtilityProcess, full_path)); |
- } else { |
- BrowserThread::PostTask( |
- BrowserThread::FILE, |
- FROM_HERE, |
- base::Bind(base::IgnoreResult(&ui::win::OpenItemViaShell), full_path)); |
- } |
+ BrowserThread::PostTask(BrowserThread::FILE, |
+ FROM_HERE, |
+ base::Bind(&OpenFileOnFileThread, full_path)); |
+} |
+ |
+void OpenFolder(Profile* profile, const base::FilePath& full_path) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
+ chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING); |
+ |
+ BrowserThread::PostTask(BrowserThread::FILE, |
+ FROM_HERE, |
+ base::Bind(&OpenFolderOnFileThread, full_path)); |
} |
void OpenExternal(Profile* profile, const GURL& url) { |