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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 294163010: Refactor "IsUnderDriveMountPoint" in v2 app code for generalization to non-Drive volumes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename Created 6 years, 7 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
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/file_system/file_system_api.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index fee90cba6dd704b109cad4d4ce2121a8485757d8..85f2c5972b595b66edc3edb9211b3d76f60b5824 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -50,7 +50,7 @@
#endif
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/drive/file_system_util.h"
+#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
#endif
using apps::SavedFileEntry;
@@ -680,12 +680,23 @@ void FileSystemChooseEntryFunction::FilesSelected(
}
content::WebContents* web_contents = app_window->web_contents();
+ DCHECK_EQ(paths.size(), 1u);
+#if defined(OS_CHROMEOS)
+ base::FilePath check_path =
+ file_manager::util::IsUnderNonNativeLocalPath(GetProfile(), paths[0])
+ ? paths[0]
+ : base::MakeAbsoluteFilePath(paths[0]);
+#else
+ base::FilePath check_path = base::MakeAbsoluteFilePath(paths[0]);
+#endif
+
content::BrowserThread::PostTask(
content::BrowserThread::FILE,
FROM_HERE,
base::Bind(
&FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread,
this,
+ check_path,
paths,
web_contents));
return;
@@ -700,17 +711,10 @@ void FileSystemChooseEntryFunction::FileSelectionCanceled() {
}
void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread(
+ const base::FilePath& check_path,
const std::vector<base::FilePath>& paths,
content::WebContents* web_contents) {
- DCHECK_EQ(paths.size(), 1u);
-#if defined(OS_CHROMEOS)
- const base::FilePath path =
- drive::util::IsUnderDriveMountPoint(paths[0]) ? paths[0] :
- base::MakeAbsoluteFilePath(paths[0]);
-#else
- const base::FilePath path = base::MakeAbsoluteFilePath(paths[0]);
-#endif
- if (path.empty()) {
+ if (check_path.empty()) {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
@@ -722,7 +726,8 @@ void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread(
for (size_t i = 0; i < arraysize(kGraylistedPaths); i++) {
base::FilePath graylisted_path;
if (PathService::Get(kGraylistedPaths[i], &graylisted_path) &&
- (path == graylisted_path || path.IsParent(graylisted_path))) {
+ (check_path == graylisted_path ||
+ check_path.IsParent(graylisted_path))) {
if (g_skip_directory_confirmation_for_test) {
if (g_allow_directory_access_for_test) {
break;
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698