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

Unified Diff: mojo/shell/filename_util.cc

Issue 1109993002: Adds support for mojo apps to live in their own directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 5 years, 8 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: mojo/shell/filename_util.cc
diff --git a/mojo/shell/filename_util.cc b/mojo/shell/filename_util.cc
index 073bddaf19d6bc76c32a45d749b4a5a05d1d9ee5..93a62c2667b0c2d606179e4b2c9fd5f7b4672c3d 100644
--- a/mojo/shell/filename_util.cc
+++ b/mojo/shell/filename_util.cc
@@ -7,6 +7,7 @@
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "url/gurl.h"
#include "url/url_canon_internal.h"
#include "url/url_util.h"
@@ -68,5 +69,20 @@ GURL AddTrailingSlashIfNeeded(const GURL& url) {
return url.ReplaceComponents(replacements);
}
+base::FilePath UrlToFilePath(const GURL& url) {
+ DCHECK(url.SchemeIsFile());
+ url::RawCanonOutputW<1024> output;
+ url::DecodeURLEscapeSequences(url.path().data(),
+ static_cast<int>(url.path().length()), &output);
+ base::string16 decoded_path = base::string16(output.data(), output.length());
+#if defined(OS_WIN)
+ base::TrimString(decoded_path, L"/", &decoded_path);
+ base::FilePath path(decoded_path);
+#else
+ base::FilePath path(base::UTF16ToUTF8(decoded_path));
+#endif
+ return path;
+}
+
} // namespace shell
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698