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

Unified Diff: chrome/browser/chromeos/fileapi/external_file_url_util.cc

Issue 615523002: Files.app: Stop to use file system URLs having externalfile:// scheme origin internally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/chromeos/fileapi/external_file_url_util.cc
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_util.cc b/chrome/browser/chromeos/fileapi/external_file_url_util.cc
index 90b4a0c0db91379f4c302334fb1803c05320007d..61aabc8e41bc7e7c28f2417581276a4c19364c59 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_util.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_util.cc
@@ -24,23 +24,23 @@ using content::BrowserThread;
namespace chromeos {
+bool IsExternalFileURLType(storage::FileSystemType type) {
+ return type == storage::kFileSystemTypeDrive ||
+ type == storage::kFileSystemTypeDeviceMediaAsFileStorage ||
+ type == storage::kFileSystemTypeProvided;
+}
+
GURL FileSystemURLToExternalFileURL(
const storage::FileSystemURL& file_system_url) {
- if (file_system_url.mount_type() != storage::kFileSystemTypeExternal)
+ if (file_system_url.mount_type() != storage::kFileSystemTypeExternal ||
+ !IsExternalFileURLType(file_system_url.type())) {
return GURL();
-
- switch (file_system_url.type()) {
- case storage::kFileSystemTypeDrive:
- case storage::kFileSystemTypeDeviceMediaAsFileStorage:
- case storage::kFileSystemTypeProvided:
- return GURL(base::StringPrintf(
- "%s:%s",
- chrome::kExternalFileScheme,
- file_system_url.virtual_path().AsUTF8Unsafe().c_str()));
-
- default:
- return GURL();
}
+
+ return GURL(base::StringPrintf(
+ "%s:%s",
+ chrome::kExternalFileScheme,
+ file_system_url.virtual_path().AsUTF8Unsafe().c_str()));
}
base::FilePath ExternalFileURLToVirtualPath(const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698