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

Unified Diff: chrome/browser/platform_util_win.cc

Issue 352393002: Be explicit about target type in platform_util::OpenItem() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 5 years, 10 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_win.cc
diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc
index b14602f494ff4d11f3f53515a0c7ad4b355ef8ce..b69d751db8634ba6933b30dc25d6ae721400d6a3 100644
--- a/chrome/browser/platform_util_win.cc
+++ b/chrome/browser/platform_util_win.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
@@ -21,6 +22,7 @@
#include "base/win/scoped_comptr.h"
#include "base/win/windows_version.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/platform_util_internal.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_utility_messages.h"
#include "content/public/browser/browser_thread.h"
@@ -32,6 +34,8 @@
using content::BrowserThread;
+namespace platform_util {
+
namespace {
void ShowItemInFolderOnFileThread(const base::FilePath& full_path) {
@@ -166,9 +170,21 @@ void OpenItemViaShellInUtilityProcess(const base::FilePath& full_path) {
utility_process_host->Send(new ChromeUtilityMsg_OpenItemViaShell(full_path));
}
-} // namespace
+void OpenItemOnBlockingThread(const base::FilePath& path) {
+ if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
+ chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING);
-namespace platform_util {
+ if (base::FieldTrialList::FindFullName("IsolateShellOperations") ==
+ "Enabled") {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&OpenItemViaShellInUtilityProcess, path));
+ } else {
+ ui::win::OpenItemViaShell(path);
+ }
+}
+
+} // namespace
void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -180,26 +196,14 @@ void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) {
base::Bind(&ShowItemInFolderOnFileThread, full_path));
}
-void OpenItem(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);
+namespace internal {
- 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));
- }
+void PlatformOpenVerifiedItem(const base::FilePath& path, OpenItemType) {
+ OpenItemOnBlockingThread(path);
}
+} // namespace internal
+
void OpenExternal(Profile* profile, const GURL& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

Powered by Google App Engine
This is Rietveld 408576698